哦,我去看看。。。
谢谢啦!
<style>
#papa { left: 14px; width: 1280px; height: 650px; top: 150px; display: grid; place-items: center; background: gray url('https://wj.zp68.com/lxx/yunhua/2022/08/27/GIF.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; }
#player { padding: 100px; position: absolute; bottom: 20px; left: 14px;width: fit-content; height: fit-content; display: flex; gap: 80px; flex-direction: column; }
#lrctext { font: bold 2em sans-serif; color: GoldEnrod; text-shadow: 1px 1px 1px #000; text-align: center; }
#btnwrap { width: fit-content; height: fit-content; display: flex; gap: 8px; align-items: center; }
#btnplay { width: 26px; height: 26px; background: url('https://wj.zp68.com/lxx/yunhua/2022/08/27/ann.png') -31px -24.5px no-repeat; border-radius: 50%; cursor: pointer; }
#btnplay:hover { border: 0px solid transparent; }
#prgline { width: 280px; height: 2px;background: #ccc linear-gradient(red,red) no-repeat ; background-size: 1px 2px; display: block; cursor: pointer;}
#tmsg { width: auto; color: Gray; }
</style>
<div id="papa">
<div id="player">
<div id="lrctext">lrc歌词</div>
<div id="btnwrap">
<span id="btnplay"></span>
<span id="prgline"></span>
<span id="tmsg">00:00 | 00:00</span>
</div>
</div>
</div>
<script>
let lrcAr = [
['00.00','爱你一生'],
['5.30','词/曲:祁隆'],
['8.07','演唱:祁隆 & 乐凡'],
['11.88','谢谢黑黑教程分享'],
['20.23','想着你'],
['22.49','曾经的温柔'],
['24.92','不知不觉眼泪在流'],
['29.75','轻轻伸出手'],
['32.18','想把你挽留'],
['34.60','仿佛一切在梦游'],
['39.14','想着你'],
['41.69','含情的双眸'],
['44.14','几多思念几多忧愁'],
['49.26','默默的回首'],
['51.42','又是一个秋'],
['53.81','期待再次与你邂逅'],
['58.41','一生为爱信守'],
['60.97','没有任何奢求'],
['63.45','只想陪你一起走'],
['67.96','我执着去等候'],
['70.50','任寂寞在心头'],
['72.88','爱你一生不回头'],
['77.69','LRC编辑:小辣椒'],
['96.90','想着你'],
['99.12','含情的双眸'],
['101.83','几多思念几多忧愁'],
['106.68','默默的回首'],
['108.92','又是一个秋'],
['111.35','期待再次与你邂逅'],
['116.03','一生为爱信守'],
['118.67','没有任何奢求'],
['121.20','只想陪你一起走'],
['125.74','我执着去等候'],
['128.30','任寂寞在心头'],
['130.51','爱你一生不回头'],
['135.86','想着你'],
['137.81','含情的双眸'],
['140.13','几多思念几多忧愁'],
['144.74','默默的回首'],
['147.36','又是一个秋'],
['149.67','期待再次与你邂逅'],
['154.40','一生为爱信守'],
['157.08','没有任何奢求'],
['159.39','只想陪你一起走'],
['164.17','我执着去等候'],
['166.46','任寂寞在心头'],
['169.25','爱你一生不回头'],
['173.65','爱你一生不回头'],
['183.30','谢谢欣赏!'],
['197.86','谢谢欣赏!']
];
let aud = new Audio(), lw = prgline.offsetWidth, bgpic = 'https://wj.zp68.com/lxx/yunhua/2022/08/27/ann.png';
aud.src = 'https://wj.zp68.com/lxx/yunhua/2022/08/27/011.mp3';
aud.autoplay = true;
aud.loop = true;
prgline.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prgline.offsetWidth;
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('playing', ()=> btnplay.style.background = 'url(' + bgpic +') -62px -24.5px no-repeat');
aud.addEventListener('pause', ()=> btnplay.style.background = 'url(' + bgpic + ') -31px -24.5px no-repeat');
aud.addEventListener('timeupdate', () => {
prgline.style.backgroundSize = lw * aud.currentTime / aud.duration + 'px 2px';
tmsg.innerText = toMin(aud.duration) + ' | ' + toMin(aud.currentTime);
for(j = 0; j < lrcAr.length;j ++) {
if(aud.currentTime >= lrcAr) lrctext.innerText = lrcAr;
}
});
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>
<br><br><br><br><br><br><br><br><br><br>
页:
1
[2]