|
|

楼主 |
发表于 2022-10-28 07:44
|
显示全部楼层
全帖代码
- <style>
- #papa { margin: auto; width: 1024px; height: 640px; background: url('https://638183.freep.cn/638183/t22/webp/high.webp') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; user-select: none; z-index: 1; --opt: .25; }
- #papa::before { position: absolute; content: url('https://638183.freep.cn/638183/t22/gif/127.gif'); transform: translate(0,-100px); mix-blend-mode: screen; }
- #papa::after { position: absolute; content: url('https://638183.freep.cn/638183/t22/gif/127.gif'); transform: translate(0,100px); mix-blend-mode: screen; }
- #mplayer { position: absolute; bottom: 10px; display: grid; grid-template-columns: auto auto auto; place-items: center; gap: 6px; user-select: none; }
- #btnplay { width: 45px; height: 45px; cursor: pointer; display: grid; place-items: center; animation: rot linear 3s infinite; position: relative; }
- #btnplay > span { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: gray; }
- #prog { --ww: 0px; width: 200px; height: 12px; border-radius: 6px; background: snow; opacity: .65; cursor: pointer; position: relative; }
- #prog::before { position: absolute; content: ''; width: var(--ww); height: 12px; border-radius: 6px; background: snow linear-gradient(90deg, red, blue); opacity: .65; }
- #audtime { font: normal 14px sans-serif; color: snow; }
- #lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; top: 20px; font: bold 2em sans-serif; color: hsl(0,10%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,0%,0%,.95)); }
- #lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(0,5%,50%,.45),hsla(240,100%,50%,.75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
- @keyframes cover1 { from { width: 0; } to { width: 100%; } }
- @keyframes cover2 { from { width: 0; } to { width: 100%; } }
- @keyframes rot { to { transform: rotate(1turn); } }
- </style>
- <div id="papa">
- <div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
- <div id="mplayer">
- <div id="btnplay"><span></span></div>
- <span id="prog"></span>
- <span id="audtime">00:00 | 00:00</span>
- </div>
- </div>
- <script>
- (function() {
- let aud = new Audio(), mKey = 0, mFlag = true, down = true;
- let lrcAr = [[1,"Lyrics by:Lolo Zouaï/Stelios Phili",1.0],[2,"Composed by:Lolo Zouaï/Stelios Phili",2.0],[4,"Des hauts et des bas",2.0],[10,"Des hauts et des bas",2.0],[12,"High highs to low lows",3.7],[16,"Yeah",0.8],[17,"High highs to low lows",5.2],[23,"I go from high highs to low lows",4.5],[28,"Des hauts et des bas",1.0],[29,"High highs to low lows",5.0],[34,"Des hauts et des bas",1.0],[35,"Yeah yeah",0.0],[35,"I can't say I've been doing okay I've been doing okay",4.5],[40,"Ouais ouais ok",1.0],[41,"And I can't wait to really get paid not just minimum wage",4.6],[46,"Ouais ouais je sais",1.0],[47,"Yeah",0.0],[47,"Fake gold on my hoops real rips on my pants",3.0],[50,"They think it's all gucci but it's 99 cents",3.0],[53,"I swear",2.0],[55,"Yeah yeah",1.0],[56,"I swear",2.0],[59,"Ooh you wanna help me",2.2],[62,"Ooh you wanna fly me out to LA",2.4],[65,"Dreams you wanna sell me",2.1],[68,"I took a bite that's a gold plate a gold plate",2.6],[71,"I go from high highs to low lows",4.6],[77,"High highs to low lows",5.0],[83,"I go from high highs to low lows",4.5],[88,"Des hauts et des bas",2.0],[90,"High highs to low lows",4.0],[94,"Des hauts et des bas",1.0],[95,"Real diamonds I want 'em but I can't find them",4.0],[99,"Timing he said it's just bad timing",3.0],[102,"Lying all I got from you was silence",4.2],[107,"No gold on my neck",2.6],[110,"No O's on my check",2.6],[113,"I swear I swear",5.6],[119,"Ooh you wanna help me",2.2],[122,"Ooh you wanna fly me out to LA",2.4],[125,"Dreams you wanna sell me",2.1],[128,"I took a bite that's a gold plate a gold plate",3.0],[131,"I go from high highs to low lows",4.6],[138,"High highs to low lows",4.5],[143,"I go from high highs to low lows",5.0],[148,"Des hauts et des bas",2.0],[150,"High highs to low lows",4.0],[154,"Des hauts et des bas",2.0],[156,"I'm not okay these days",2.0],[158,"Dreams come and go I stay",3.0],[161,"J'ai du mal à m'exprimer mais j'essaye",6.0],[167,"I was alone when I fell",3.0],[170,"Where did you go",1.0],[171,"Pas de nouvelle",2.0],[173,"J'ai beaucoup de mal de coeur mal de coeur",6.5],[180,"Save me now you wanna save me",4.5],[186,"Save me now you wanna save me",4.0],[190,"I go from high highs to low lows",7.0],[197,"High highs to low lows",5.3],[203,"I go from high highs to low lows",5.0],[208,"Des hauts et des bas",1.0],[209,"High highs to low lows",5.0],[214,"Des hauts et des bas",3.0],[217,"Tu sais la vie est pleine de hauts et de bas",4.6],[222,"Mais sans les bas les hauts ne veulent rien dire",5.8]];
- aud.src = 'https://music.163.com/song/media/outer/url?id=518092465.mp3';
- aud.loop = true;
- aud.autoplay = true;
- if(aud.paused) btnplay.style.animationPlayState = 'paused';
- btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
- prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
- aud.addEventListener('seeked', () => calcKey());
- aud.addEventListener('pause', () =>mState());
- aud.addEventListener('play', () =>mState());
- aud.addEventListener('timeupdate', () => {let prg = aud.currentTime * prog.offsetWidth / aud.duration < 6 ? 6 : aud.currentTime * prog.offsetWidth / aud.duration;prog.style.setProperty('--ww', prg + 'px');audtime.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);for(j=0; j<lrcAr.length; j++) {if(aud.currentTime >= lrcAr[j][0]) {cKey = j;if(mKey === j) showLrc(lrcAr[j][2]);else continue;}}});
- let calcKey = () => {for(j = 0; j < lrcAr.length; j ++) {if(aud.currentTime <= lrcAr[j][0]) {mKey = j - 1;break;}}if(mKey <0) mKey = 0;if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;let time = lrcAr[mKey][2] - (aud.currentTime - lrcAr[mKey][0]);showLrc(time);};
- let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr[mKey][1];lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
- let mState = () => aud.paused ? (btnplay.style.animationPlayState='paused',lrc.style.setProperty('--state', 'paused'),papa.style.setProperty('--opt','0')) : (btnplay.style.animationPlayState='running', lrc.style.setProperty('--state', 'running'),papa.style.setProperty('--opt','.25'));
- 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;};
- (function mkSpan() {[...Array(10).keys()].forEach((ele,key) => {ele = document.createElement('span');ele.style.cssText += `background: linear-gradient(135deg, #${Math.random().toString(16).substr(-6)}, #${Math.random().toString(16).substr(-6)}); transform: rotate(${key*36}deg) translate(18px)`;btnplay.appendChild(ele);});})();
- })();
- </script>
复制代码
|
评分
-
| 参与人数 1 | 威望 +50 |
金钱 +100 |
经验 +50 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|