|
|

楼主 |
发表于 2022-9-18 07:17
|
显示全部楼层
代码
- <style>
- #papa { left: -214px; width: 1024px; height: 640px; background: #ccc url('https://638183.freep.cn/638183/qd/layudown.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
- #mplayer { position: absolute; bottom: 0; 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, black, blue 100%, transparent 0); border: 1px solid gray; font: normal 14px / 16px sans-serif; color: olive; opacity: .75; }
- #lrc { position: absolute; top: 15px; font: bold 2em sans-serif; color: transparent; background: linear-gradient(-90deg, tomato, snow) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
- #birds {position: absolute;left: 0;top: 0;width: 200px;offset-distance: 0;offset-path: path("M1100 50 H200 L-100 -50");animation: move 12s linear infinite;}
- @keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
- @keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
- @keyframes move { to { offset-distance: 100%;} }
- </style>
- <div id="papa">
- <img id="birds" src="https://638183.freep.cn/638183/qd/rini.png" 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, 'IRNI - Lay you down', 32],
- [32.39, 'baby, come thru tonight', 3.5],
- [36.64, 'lay you down', 1],
- [38.10, 'let me slide in you', 5.5],
- [47.93, 'cus lately, i can\'t deny', 4],
- [52.73, 'think about you all the time yh (all the time uh)', 8],
- [65.15, 'long day bet you could use some company', 6],
- [73.09, 'lets play i come to you or you can come to me', 6],
- [79.92, 'no i dont mind but i will try midnight', 7],
- [87.13, 'i can come whatever time (whatever time)', 5],
- [96.24, 'baby come thru tonight', 4],
- [100.57, 'lay you down', 1],
- [102.00, 'let me slide in you', 5],
- [111.92, 'cus lately, i can\'t deny', 4],
- [116.63, 'think about you all the time yh (all the time uh)', 8],
- [128.55, 'i wanna run my hands through your hair', 3],
- [132.20, 'get it down no i don\'t play fair', 4],
- [137.95, 'just let me take care of you', 2],
- [142.99, 'or if you want we can just talk', 5],
- [148.82, 'there\'s so much we could share about love (ohhhhh)', 5.5],
- [157.10, 'so much we could share about', 2.5],
- [160.24, 'baby, come thru tonight', 4],
- [164.64, 'lay you down', 1],
- [166.39, 'let me slide in you', 6.5],
- [176.00, 'cus lately, i can\'t deny', 4],
- [180.41, 'think about you all the time (all the time uh)', 8],
- [225.26, 'baby, come thru tonight', 3],
- [228.86, 'lay you down', 1],
- [230.61, 'let me slide in you', 5],
- [240.25, 'cus lately, i can\'t deny', 4],
- [244.79, 'think about you all the time (all the time uh)', 8],
- ];
- let mKey = 0, mSeek = false, mFlag = true;
- let aud = new Audio();
- aud.src = 'https://music.163.com/song/media/outer/url?id=1376901250.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, black, blue ' + 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[j][0]) {
- if(mKey === j) showLrc(lrcAr[j][2]);
- 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];
- mKey += 1;
- mFlag = !mFlag;
- }
- let calcKey = () => {
- for(j = 0; j < lrcAr.length; j ++) {
- if(aud.currentTime <= lrcAr[j][0]) {
- mKey = j - 1;
- break;
- }
- }
- if(mKey <0) mKey = 0;
- let mtime = lrcAr[mKey][2] - (aud.currentTime - lrcAr[mKey][0]);
- 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>
复制代码
|
评分
-
| 参与人数 1 | 威望 +50 |
金钱 +100 |
经验 +50 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|