亚伦影音工作室 发表于 7 天前

独家代码【dj站台】

本帖最后由 亚伦影音工作室 于 2026-11-13 08:31 编辑 <br /><br /><style>@import url("https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap");
#papa{margin: 10px -250px;
        width: 1286px;
        height: 720px;
        background:#880000;
        box-shadow: 0px 0px 0px 2px #eee, 0px 0px 0px 8px #880000;
        position: relative;overflow: hidden;
        z-index: 12345;}
#loge {
    position: absolute;
    width: 12%;
    height: 12%;
    top: 390px;
   animation:color1s linear 1.5s infinite;
    left: 45px;
    opacity: 1;
}
#sp {
    position: absolute;
    width: 65%;
    height: 65%;
    top: 40px;
    object-fit: cover;
    pointer-events: none;
    left: 350px;
    opacity: 1;
}
#xiaobo {z-index: 100;
      width: 350px;
      height: 220px;
      margin: 100px 3%;
      position: relative;
      overflow: hidden;
      --state:paused;
      }
.hexahedron {width: 210px;
      height: 210px;
      margin: 0px 0px;
border: 2px solid #cccccc;
         position: relative; z-index: 1;
      background:#8B4513;border-radius: 8px;mask: radial-gradient(circle at 100% 50%,transparent 42px,#red 0%);-webkit-mask: radial-gradient(circle at 100% 50%,transparent 42px,red 0%); }
#cp { position: relative; top: 0px; left: 0px;width: 200px; height: 200px;transition: 2s;animation:opentop 0.5s 1 0s ;border-radius: 50%; box-shadow: 0px 0px 0px 2px #cccccc;}
#all {position: absolute;width:200px; height:200px;top: 6px; left: 115px;z-index: -1; transition: 2s; animation:tion3s linear 1.5s infinite}
@keyframes opentop { 0% {transform: translatex(-50px);} 100% { transform:rotateX(0px);}}
@keyframes tion { 0% {} 100% { transform:rotate(360deg) } }
#bnt{margin: 150px 2px ; width: 90px; height: 35px;position: absolute; cursor: pointer; z-index: 100;transition: all 1s;}
#cndpt{position: absolute; width: 100%; height: 100%;opacity:1;border-radius: 10px;
   background: url(https://pic1.imgdb.cn/item/6a276eb33c9809430d38a9dc.png)no-repeat 0 0px/cover;}
#enopg{ position: absolute;width: 100%; height: 100%; border-radius: 10px;
opacity:0;background: url(https://pic1.imgdb.cn/item/6a276eb33c9809430d38a9dd.png)no-repeat 0 0px/cover;
}
#dt{margin: 0px 0px ; width: 200px; height: 200px;position: absolute; z-index: 10;transition: all 1s;}
#cndt{position: absolute; width: 100%; height: 100%; border-radius: 0px;opacity:1;
   background: url(https://pic1.imgdb.cn/item/69fef2745a52df004a05f3e7.gif)no-repeat 0 0px/cover;}
#cnpg{ position: absolute;width: 100%; height: 100%; border-radius: 0px;opacity:0;
background: url(https://pic1.imgdb.cn/item/6a27757b3c9809430d38d152.png)no-repeat 0 0px/cover;
}
#tmsg {position: absolute;
      font: 400 10px sans-serif;
      color: #fff;
         bottom: 10px;
      left:100px;}
#prog {position:absolute;
      width: 98%;
      height: 2px;background:#aaa;
      cursor: pointer;
         top: 22%;border-radius: 10px;
left:1%;
position:relative;
}
#prog-bar {border-radius: 20px;
            height: 100%;
            background: #FF0000;
            width: 0%;
            position: relative;
      }
#lyricWrap {position: absolute;
    width: 100%;top: 86%; left: 0%;
   
    font: 300 44px "Ma Shan Zheng";
    text-align: center;
    color: #fff;
    text-shadow: 1px 1px 3px #000;
    cursor: pointer;
    user-select: none;
    min-height: 48px;
    line-height: 1.4;
perspective: 2px;
}
@keyframes color { from {
   filter: hue-rotate(0);
}
to {
   filter: hue-rotate(360deg);
}
}

/* 进度条伪元素滑块 */
#prog-bar::after{
    content:"";
    position:absolute;
    right:0;
    top:50%;
    transform: translate(50%,-50%);
    width:10px;
    height:10px;
    border-radius:50%;
    background:#ff0000;
    box-shadow:0 0 4px #000000;
    z-index:2;
}

/* 字由远到近推进【修复看不见】 */
@keyframes jumpSpin{
    0% {transform:rotatex(360deg)}

80% {transform: rotatex(0deg);}


100% {transform:rotate(0deg)}
}
.lyric-char-active{
    animation: jumpSpin 2s ease-out forwards;
    transform-origin: center;
}

</style>
<div id="papa">
<video id="sp" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/5173292549110c110ecc461dea489e4c_preview.mp4" autoplay="" loop="" muted=""></video>
<div id="xiaobo">
<div class="hexahedron">
<div id="bnt" >
<div id="cndpt"></div>
<div id="enopg"></div>
</div>
<div id="dt" >
<div id="cndt"></div>
<div id="cnpg"></div>
<div id="tmsg">00:00/00:00</div>
</div>
</div>
<div id="all">
<img src="https://pic1.imgdb.cn/item/69e5e442198dd6f8d6ac9407.png"id="cp" />
</div>
</div>
<img id="loge" src="https://www.panurl.cn/view.php/6ecfb13be39ce8b9ef64613adb8a2422.png"   />

<div id="prog" title="播放进度条"><div id="prog-bar"></div></div>
<div id="lyricWrap"></div>
</div>
<audio id="aud" src="https://www.panurl.cn/view.php/65a9519633e01b426f312ef6918af1d0.m4a" loop autoplay>
<script>
//原有播放器逻辑
aud.addEventListener('pause', () => mState());
aud.addEventListener('playing', () => mState());
bnt.onclick = () => aud.paused ? (aud.play(), sp.play(),all.style.left = '115px',enopg.style.opacity= '0',cndpt.style.opacity = '1',
cndt.style.opacity= '1',cnpg.style.opacity= '0',all.style.animationPlayState = 'running') : (aud.pause(),sp.pause(),all.style.left = '30px',enopg.style.opacity = '1',cndpt.style.opacity = '0',cndt.style.opacity= '0',cnpg.style.opacity= '1',all.style.animationPlayState = 'paused');

// ========= 拖拽进度条 =========
var isDragging = false;
prog.onmousedown = function(e){
    isDragging = true;
    updateProgressByMouse(e);
};
function updateProgressByMouse(e){
    if(!aud.duration) return;
    var rect = prog.getBoundingClientRect();
    var x = e.clientX - rect.left;
    if(x < 0) x = 0;
    if(x > rect.width) x = rect.width;
    aud.currentTime = aud.duration * x / rect.width;
}
document.addEventListener('mousemove',function(e){
    if(isDragging){
      updateProgressByMouse(e);
    }
});
document.addEventListener('mouseup',function(){
    isDragging = false;
});

var progBar = document.getElementById('prog-bar');
aud.addEventListener('timeupdate', () => {
    if(!isDragging){
      varpercent= (aud.currentTime / aud.duration) * 100;
      progBar.style.width = percent + '%';
    }
});
aud.addEventListener('timeupdate', () => {
                tmsg.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);});
let toMin = (val) => {
                if (!val) return '00:00';
                val = Math.floor(val);
                let min = parseInt(val / 60),
                        sec = parseFloat(val % 60);
                if (min < 10) min = '0' + min;
                if (sec < 10) sec = '0' + sec;
                return min + ':' + sec;
      };
</script>
<script>
var aud = document.getElementById("aud");
var wrap = document.getElementById("lyricWrap");
var rainbowColors = [
    "#ff2a2a",
    "#ff7a00",
    "#ffcc00",
    "#22cc22",
    "#00aaff",
    "#6666ff",
    "#ff55ff"
];
var lrcText = `站台(新编)-十二大美女
作曲:刘恒锋 作词:刘恒锋
制作人:亚伦
长长的站台 漫长的等待
长长的列车 载着我短暂的爱
喧嚣的站台 寂寞的等待
只有出发的爱 没有我归来的爱
哦 孤独的站台
哦 寂寞的等待
我的心在等待 永远在等待
我的心在等待 永远在等待
我的心在等待 永远在等待
我的心在等待 在等待
长长的站台 漫长的等待
长长的列车 载着我短暂的爱
我的心在等待 永远在等待
我的心在等待 永远在等待
我的心在等待 永远在等待
我的心在等待 在等待
永远在等待呀

`;
var lrcAr = [];
var charList = [];
var currentLineIndex = -1;
var scanDuration = 3.8;

function timeToSec(str) {
    var t = str.match(/\d+/g);
    return Number(t) * 60 + Number(t) + Number(t || 0) / 1000;
}
function parseLrc(lrc) {
    var reg = /\[(\d{1,}:\d{1,}(?:\.\d{1,})?)\](.*)/g;
    var arr = [];
    var m;
    while ((m = reg.exec(lrc)) !== null) {
      arr.push(), m.trim()]);
    }
    return arr;
}
function renderLine(text) {
    wrap.innerHTML = "";
    charList = [];
    for (var i = 0; i < text.length; i++) {
      var span = document.createElement("span");
      span.textContent = text;
      span.style.display = "inline-block";
      span.style.color = "#cccccc";
      wrap.appendChild(span);
      charList.push({
            dom: span,
            color: rainbowColors,
            done: false
      });
    }
}

function syncLyric() {
    var t = aud.currentTime;
    var idx = -1;
    for (var i = 0; i < lrcAr.length; i++) {
      var nextT = lrcAr ? lrcAr : 9999;
      if (t >= lrcAr && t < nextT) {
            idx = i;
      }
    }
    if (idx === -1) {
      requestAnimationFrame(syncLyric);
      return;
    }
    var line = lrcAr;
    var start = line;
    var text = line;
    if (idx !== currentLineIndex) {
      currentLineIndex = idx;
      renderLine(text);
    }
    if (charList.length) {
      var offset = t - start;
      var progress = Math.min(offset / scanDuration, 1);
      var lit = Math.floor(progress * charList.length);
      for (var k = 0; k < charList.length; k++) {
            if(k < lit && !charList.done){
                charList.done = true;
                charList.dom.style.color = charList.color;
                charList.dom.classList.add("lyric-char-active");
            }
      }
    }
    requestAnimationFrame(syncLyric);
}
lrcAr = parseLrc(lrcText);
syncLyric();
</script>

klxf 发表于 7 天前

好听好看,谢谢亚伦老师精彩分享

醉美水芙蓉 发表于 昨天 19:08

欣赏亚伦老师漂亮播放器!
页: [1]
查看完整版本: 独家代码【dj站台】