请跟我来(抄袭一个)
<style>
#papa { left: -400px; width: 1400px; height: 800px; background: #ccc url('https://pic.imgdb.cn/item/63267af216f2c2beb1f8edb2.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; position: relative; z-index: 1; }
#mplayer { position: absolute; top: 640px; width: 300px; height: 80px; user-select: none; display: grid; place-items: center; cursor: pointer; }
#mplayer:hover #btnwrap, #mplayer:hover #prog { transform: translateY(var(--yy)); }
#mplayer:hover #btnwrap { background: linear-gradient(to top right, red, green); border-radius: 50%; opacity: .75; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center;transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; transform: rotate(45deg); border: 1px solid tan; border-radius: 6px; opacity: .25; }
#btnplay { width: 20px; height: 20px; background: #eee; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent #eee; display: none; }
#prog { --yy: 20px; width: 300px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, orange, red 100%, transparent 0); border: 1px solid gray; font: normal 14px / 16px sans-serif; color: #1551C8; opacity: .75; }
#lrc { position: absolute; top: 600px; font: bold 2em sans-serif; color: transparent; letter-spacing: 2px; background: linear-gradient(-90deg, darkred, pink) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
#mpic { position: absolute; width: 100%; height: 100%; mix-blend-mode: multiply; }
@keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
</style>
<div id="papa">
<img id="mpic" src="" alt="" />
<div id="lrc">花潮论坛lrc在线</div>
<div id="mplayer">
<div id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></div>
<div id="prog">00:00 | 00:00</div>
</div>
</div>
<script>
let lrcAr = [
['0.00','请跟我来',15.3],
['16.00','我踩着不变的步伐','6'],
['22.00','是为了配合你到来','5'],
['29.00','在慌张迟疑的时候','5.5'],
['35.00','请跟我来','6'],
['42.00','我带着梦幻的期待','5.6'],
['48.00','是无法按捺的情怀','5'],
['54.00','在你不注意的时候','6'],
['61.00','请跟我来','5'],
['70.00','别说什么','6'],
['76.00','那是你无法预知的世界','6'],
['84.00','别说你不用说','5.5'],
['89.00','你的眼睛已经告诉了我','6'],
['102.00','当春雨飘呀飘的飘在','6'],
['108.00','你滴也滴不完的发梢','6'],
['115.00','戴着你的水晶珠链','6.5'],
['121.00','请跟我来','7'],
['140.00','别说什么','7'],
['147.00','那是你无法预知的世界','8'],
['155.00','别说你不用说','5'],
['159.00','你的眼睛已经告诉了我','6'],
['172.00','当春雨飘呀飘的飘在','7'],
['179.00','你滴也滴不完的发梢','5'],
['185.00','戴着你的水晶珠链','6'],
['192.00','请跟我来','7']
];
let mKey = 0, mSeek = false, mFlag = true;
let aud = new Audio();
aud.src = 'https://music.163.com/song/media/outer/url?id=1444480110.mp3';
aud.autoplay = true;
aud.loop = true;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.style.background= 'linear-gradient(90deg, green, red ' + aud.currentTime / aud.duration * 100 + '%, snow 0)';
prog.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
for(j=0; j<lrcAr.length; j++) {
if(aud.currentTime >= lrcAr) {
if(mKey === j) showLrc(lrcAr);
else continue;
}
}
});
let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none', lrc.style.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc.style.animationPlayState = 'running');
let showLrc = (time) => {
lrc.style.animation = (mFlag ? 'bgMove1 ' : 'bgMove2 ') + time + 's linear forwards';
lrc.innerHTML = lrcAr;
mKey += 1;
mFlag = !mFlag;
}
let calcKey = () => {
for(j = 0; j < lrcAr.length; j ++) {
if(aud.currentTime <= lrcAr) {
mKey = j - 1;
break;
}
}
if(mKey <0) mKey = 0;
let mtime = lrcAr - (aud.currentTime - lrcAr);
showLrc(mtime);
}
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> 这个画面干净,去旅游啊{:4_189:} 走,去看海。。{:4_174:} 红芍药 发表于 2022-9-18 10:13
走,去看海。。
去吃海鲜。。。。{:5_117:} 老头哈哈~~~你太强大了,盗窃的不留痕迹,别人怎么晓得你是盗窃的。
高手就是高手{:4_178:} 这个歌词同步捣鼓起来也是花时间的,这样好{:4_170:} 少了个png,这个你可以自己加的 小辣椒 发表于 2022-9-18 10:48
老头哈哈~~~你太强大了,盗窃的不留痕迹,别人怎么晓得你是盗窃的。
高手就是高手
没弄歌词同步,脑袋疼。。。。{:5_117:} 小辣椒 发表于 2022-9-18 10:50
少了个png,这个你可以自己加的
俺把那个取消了,留着位置备用。。。。 小辣椒 发表于 2022-9-18 10:50
少了个png,这个你可以自己加的
对了师傅,你那动态PNG是在哪找的? 东篱闲人 发表于 2022-9-18 11:00
对了师傅,你那动态PNG是在哪找的?
那个纸飞机?不是动态的,是加了路径代码 小辣椒 发表于 2022-9-18 11:06
那个纸飞机?不是动态的,是加了路径代码
明白了。{:4_190:} 东篱闲人 发表于 2022-9-18 10:55
俺把那个取消了,留着位置备用。。。。
那个有效果的,用浅颜色的漂亮一点,我试过了 东篱闲人 发表于 2022-9-18 10:54
没弄歌词同步,脑袋疼。。。。
是的,哈哈{:4_189:} 小辣椒 发表于 2022-9-18 11:07
那个有效果的,用浅颜色的漂亮一点,我试过了
{:4_181:} 小辣椒 发表于 2022-9-18 11:07
是的,哈哈
保护脑袋,人人有责。。。。{:5_112:} 东篱闲人 发表于 2022-9-18 11:18
保护脑袋,人人有责。。。。
但会了就很快了 小辣椒 发表于 2022-9-18 11:20
但会了就很快了
不弄。眼睛疼。保护眼睛,人人有责。。。。{:5_117:} 这个评分后依然正常运行,意外收获。
原因大概是,有一个 audio 的 seeked 监控机制,评分时论坛异步提交评分资料,然后局部刷新页面,这时,seeked 的监听事件被触发,相应的JS函数就运行起来,从而正常。 都牵手了,跟不跟由不得自己啦{:4_170:}