前言
闲来无事,又看到了Aplayer这个网页嵌入音乐播放器,之前觉得这个外观什么的不够吸引人,现在需要用得上了,觉得应该对其进行美化一番
所以做出了以下的效果,觉得已经够看了
效果实现
使用方法
这是使用方法,需要先引入Aplayer和MetingJS,然后再在网页加入下面的,参数可以自行修改
<div class="music-player-container">
<div class="music-player">
<!-- MetingJS 播放器 -->
<meting-js
server="netease"
type="playlist"
id="2221783533"
fixed="false"
mini="false"
autoplay="false"
theme="#6ebeff"
loop="all"
order="list"
preload="auto"
volume="0.7"
mutex="true"
list-folded="true"
list-max-height="150px"
class="meting-player">
</meting-js>
</div>
</div>
<style>
/* 使用你提供的自定义字体 - 只应用于播放器 */
@font-face {
font-family: 'MaShanZheng';
src: url('https://cdn.xiaomoran.me/gh/moranshuai/live2d-widget-v3@main/MaShanZheng-Regular.ttf') format('truetype');
font-display: swap;
}
/* 只重置播放器内部元素的样式 */
.music-player-container * {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* 音乐播放器主容器 - 嵌入样式 */
.music-player-container {
font-family: 'MaShanZheng', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
width: 100%;
max-width: 400px;
margin: 20px auto;
display: block;
}
.music-player-title {
text-align: center;
color: #333;
margin-bottom: 15px;
font-size: 20px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
/* 播放器容器 - 液态玻璃效果 */
.music-player {
position: relative;
border-radius: 16px;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(12px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.9);
box-shadow: 0 6px 24px rgba(31, 38, 135, 0.15),
inset 0 2px 12px rgba(255, 255, 255, 0.4);
overflow: hidden;
transition: all 0.3s ease;
}
/* 悬停效果 */
.music-player:hover {
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2),
inset 0 4px 16px rgba(255, 255, 255, 0.5);
transform: translateY(-2px);
}
/* 液态玻璃光泽效果 */
.music-player::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.1);
border-radius: 16px;
backdrop-filter: blur(1px);
box-shadow: inset -8px -6px 0px -9px rgba(255, 255, 255, 1),
inset 0px -7px 0px -6px rgba(255, 255, 255, 1);
opacity: 0.5;
z-index: -1;
filter: blur(1px) brightness(115%);
pointer-events: none;
}
/* 自定义 MetingJS 播放器样式 */
.meting-player {
--aplayer-theme: #6ebeff !important;
--aplayer-lrc-color: #0066cc !important;
--aplayer-background: transparent !important;
}
/* 覆盖 APlayer 默认样式 */
.music-player .aplayer {
font-family: 'MaShanZheng', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
background: transparent !important;
border-radius: 16px !important;
margin: 0 !important;
box-shadow: none !important;
transition: all 0.3s ease !important;
}
/* 蓝白渐变背景 */
.music-player .aplayer .aplayer-info {
background: linear-gradient(135deg, #6ebeff 0%, #a8d8ff 50%, #e6f3ff 100%) !important;
padding: 12px 12px 8px 12px !important;
margin: 0 !important;
border-top-left-radius: 16px !important;
border-top-right-radius: 16px !important;
border-bottom: none !important;
}
/* 圆角专辑封面 */
.music-player .aplayer .aplayer-pic {
border-radius: 10px !important;
overflow: hidden;
box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease !important;
}
/* 封面悬停动画 */
.music-player .aplayer .aplayer-pic:hover {
transform: scale(1.03) rotate(1deg) !important;
}
/* 播放按钮动画 */
.music-player .aplayer .aplayer-play {
animation: gentlePulse 3s ease-in-out infinite !important;
}
@keyframes gentlePulse {
0%, 100% {
transform: scale(1);
opacity: 0.8;
}
50% {
transform: scale(1.05);
opacity: 1;
}
}
/* 播放进度条样式调整 */
.music-player .aplayer .aplayer-bar {
background: rgba(255, 255, 255, 0.3) !important;
border-radius: 2px;
height: 3px;
}
.music-player .aplayer .aplayer-bar .aplayer-loaded {
background: rgba(255, 255, 255, 0.5) !important;
height: 3px;
border-radius: 2px;
}
.music-player .aplayer .aplayer-bar .aplayer-played {
background: rgba(255, 255, 255, 0.9) !important;
height: 3px;
border-radius: 2px;
box-shadow: 0 0 4px rgba(110, 190, 255, 0.6);
}
.music-player .aplayer .aplayer-bar .aplayer-played .aplayer-thumb {
background: #ffffff !important;
box-shadow: 0 0 6px rgba(110, 190, 255, 0.8);
border: 2px solid #6ebeff;
width: 10px;
height: 10px;
top: -3.5px;
}
.music-player .aplayer .aplayer-lrc:before,
.music-player .aplayer .aplayer-lrc:after {
display: none !important;
}
.music-player .aplayer .aplayer-lrc p.aplayer-lrc-current {
color: #0066cc !important;
opacity: 1;
font-weight: bold;
text-shadow: 0 0 1px rgba(255, 255, 255, 0.5) !important;
}
/* 列表样式 */
.music-player .aplayer .aplayer-list {
background: rgba(255, 255, 255, 0.1) !important;
backdrop-filter: blur(5px) !important;
border-bottom-left-radius: 16px !important;
border-bottom-right-radius: 16px !important;
border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.music-player .aplayer .aplayer-list ol li {
border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
color: rgba(0, 0, 0, 0.7) !important;
transition: all 0.3s ease;
padding: 8px 12px !important;
font-size: 13px !important;
}
.music-player .aplayer .aplayer-list ol li:hover {
background: rgba(255, 255, 255, 0.2) !important;
}
.music-player .aplayer .aplayer-list ol li.aplayer-list-light {
background: rgba(255, 255, 255, 0.25) !important;
color: #0066cc !important;
}
.music-player-footer {
text-align: center;
margin-top: 12px;
color: rgba(0, 0, 0, 0.6);
font-size: 12px;
}
</style>

Comments NOTHING