|
|

楼主 |
发表于 2022-10-10 08:50
|
显示全部楼层
代码
- <style>
- #papa { left: -214px; width: 1024px; height: 640px; background: teal url('https://638183.freep.cn/638183/t22/webp/ysh.webp') no-repeat center/cover; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
- #btnplay { --dur: 10s; position: absolute; top: 30%; width: 40px; height: 40px; font: bold 40px/40px serif; text-align: center; color: red; cursor: pointer; animation: rot linear var(--dur) infinite; }
- .mpic { position: absolute; left: 1024px; top: 60px; width: 120px; mix-blend-mode: multiply; animation: fly linear 40s infinite; }
- #lrc { --motion: cover1; --tt: 1s; --state: paused; position: absolute; top: 15px; font: bold 2.4em sans-serif; color: hsl(0,100%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,100%,0%,.85)); }
- #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,100%,50%,.75),hsla(60,100%,50%,.65)); 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(360deg); } }
- @keyframes fly { to { left: -120px; } }
- </style>
- <div id="papa">
- <img class="mpic" src="https://638183.freep.cn/638183/t22/hl/kite1.gif" alt="" />
- <span id="btnplay">★</span>
- <span id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</span>
- </div>
- <audio id="aud" src="http://www.kumeiwp.com/sub/filestores/2021/09/21/2926751e89bb5eeb059319bb807e62d0.mp3" autoplay= "autoplay"></audio>
- <script>
- (function() {
- let mKey = 0, mFlag = true, slip = 0.5;
- let lrcAr = [[0,"《映山红》",8.0],[8,"演唱:阿鲁阿卓",8.0],[18,"作词:陆柱国",7.0],[25,"作曲:傅庚辰",7.0],[34,"☆ 花潮LRC在线 ☆",8.0],[51.05,"夜半三更哟 盼天明",9.0],[60.04,"寒冬腊月哟 盼春风",9.0],[69.07,"若要盼得哟 红军来",9.0],[78.09,"岭上开遍哟 映山红",9.9],[88.03,"岭上开遍哟 映山红",9.0],[97.03,"岭上开遍哟 映山红",9.1],[127.06,"夜半三更哟 盼天明",9.0],[136.06,"寒冬腊月哟 盼春风",9.0],[145.08,"若要盼得哟 红军来",9.9],[155.01,"岭上开遍哟 映山红",8.0],[164.04,"若要盼得哟 红军来",9.0],[173.05,"岭上开遍哟 映山红",9.0],[182.09,"岭上开遍哟 映山红",9.0],[191.09,"岭上开遍哟 映山红",10.0],[222.01,"若要盼得哟 红军来",9.0],[231.01,"岭上开遍哟 映山红",9.0],[240.04,"岭上开遍哟 映山红",9.0],[249.04,"岭上开遍哟 映山红",10.0],[261.1,"岭上开遍哟 映山红",12.0],[274.09,"☆ 花潮LRC在线 ☆",2.9],[277,"☆ 感谢支持 ☆",6]];
- aud.loop = false;
- btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
- aud.addEventListener('pause', () => mState());
- aud.addEventListener('play', () => mState());
- aud.addEventListener('ended', () => { mKey = 0; aud.play(); });
- aud.addEventListener('timeupdate', () => {
- for (j = 0; j < lrcAr.length; j++) {
- if (aud.currentTime - slip >= lrcAr[j][0]) {
- if (mKey === j) showLrc(lrcAr[j][2]);
- else continue;
- }
- }
- });
- let mState = () => aud.paused ? (btnplay.style.animationPlayState = 'paused', lrc.style.setProperty('--state', 'paused')) : (btnplay.style.animationPlayState = 'running', lrc.style.setProperty('--state', 'running'));
- 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;
- };
- })();
- </script>
复制代码
|
|