醉美水芙蓉 发表于 2022-10-29 10:47

美丽的人生旅途

本帖最后由 醉美水芙蓉 于 2022-10-29 10:47 编辑 <br /><br /><style>
#papa { left: -214px; width: 1024px; height: 640px; background: url('https://s1.ax1x.com/2022/10/29/x4Xu1U.jpg') 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('http://tuku.link/imgs/2022/03/e22cb4cb173e2317.gif'); transform: translate(0,-120px); mix-blend-mode: screen; }
#papa::after { position: absolute; content: url('http://tuku.link/imgs/2022/03/e22cb4cb173e2317.gif'); transform: translate(0,110px); 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: 40px; height: 40px; 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; 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: 520px; font: bold 2em sans-serif; color: hsl(60, 100%, 50%); -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(120,90%,50%,.45),hsla(120,90%,50%,.45)); 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 = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
        aud.src = 'https://www.qqmc.com/up/kwlink.php?id=247177621&.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) {cKey = j;if(mKey === j) showLrc(lrcAr);else continue;}}});
        let calcKey = () => {for(j = 0; j < lrcAr.length; j ++) {if(aud.currentTime <= lrcAr) {mKey = j - 1;break;}}if(mKey <0) mKey = 0;if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;let time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
        let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr;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>

起个网名好难 发表于 2022-10-29 11:16

欣赏、点赞

马黑黑 发表于 2022-10-29 11:18

这个手链按钮漂亮吧

闲言不语 发表于 2022-10-29 11:21

望海高歌的歌都轻快,好听!

醉美水芙蓉 发表于 2022-10-29 11:34

起个网名好难 发表于 2022-10-29 11:16
欣赏、点赞

谢谢老师欣赏支持!

醉美水芙蓉 发表于 2022-10-29 11:35

马黑黑 发表于 2022-10-29 11:18
这个手链按钮漂亮吧

是的,谢谢黑黑老师的源代码创作!非常喜欢这个播放器!

醉美水芙蓉 发表于 2022-10-29 11:36

闲言不语 发表于 2022-10-29 11:21
望海高歌的歌都轻快,好听!

谢谢不语老师欣赏点评!

马黑黑 发表于 2022-10-29 11:58

醉美水芙蓉 发表于 2022-10-29 11:35
是的,谢谢黑黑老师的源代码创作!非常喜欢这个播放器!

喜欢就好{:4_190:}

大猫咪 发表于 2022-10-29 12:56

制作非常棒!好提好看! 点赞, 水芙蓉周末快乐!

{:4_204:}{:4_199:}

醉美水芙蓉 发表于 2022-10-29 12:59

大猫咪 发表于 2022-10-29 12:56
制作非常棒!好提好看! 点赞, 水芙蓉周末快乐!

猫咪周末愉快!

红影 发表于 2022-10-29 13:47

制作漂亮,歌词很阳光。欣赏水芙蓉美女好帖{:4_187:}

醉美水芙蓉 发表于 2022-10-29 14:01

红影 发表于 2022-10-29 13:47
制作漂亮,歌词很阳光。欣赏水芙蓉美女好帖

谢谢红影美女鼓励!

红影 发表于 2022-10-29 19:50

醉美水芙蓉 发表于 2022-10-29 14:01
谢谢红影美女鼓励!

客气了,问好{:4_187:}

相约爱晚亭 发表于 2022-10-30 07:51

欣赏精美音画佳作!

醉美水芙蓉 发表于 2022-10-30 11:42

相约爱晚亭 发表于 2022-10-30 07:51
欣赏精美音画佳作!

谢谢老师支持!
页: [1]
查看完整版本: 美丽的人生旅途