醉美水芙蓉 发表于 2022-11-3 21:41

爱情幸福的味道-梅朵

<style>
#papa { left:-214px; width: 1024px; height: 683px; background: silver url('https://s1.ax1x.com/2022/11/03/xqdUkd.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; user-select: none; position: relative; z-index: 1; }
#mplayer { position: absolute; width: 400px; height: 110px; left:50px; bottom: 10px; font: normal 14px sans-serif; z-index: 9; }
#mplayer::before, #mplayer::after { position: absolute; width: 100%; height: 50%; color: tan; margin: 70px 0; }
#mplayer::before { content: attr(data-cur); }
#mplayer::after { content: attr(data-dur); text-align: right; }
.btnplay { position: absolute; width: 40px; height: 20px; left:50%; top: 48px; background: linear-gradient(to left,hsla(230,50%,70%,.6),hsla(60,80%,50%,.7)); border-radius: 0 100%; transform-origin: 0 0; animation: rot linear 4s infinite; animation-play-state: paused; }
.btnplay::before, .btnplay::after { position: absolute; width: 100%; height: 100%; content: ''; background: inherit; border-radius: inherit; transform-origin: 0 0; transform: rotate(120deg); }
.btnplay::after { transform: rotate(240deg); }
#prog { --posX: 0px; position: absolute; bottom: 10px; width: 100%; height: 1px; background: tan; cursor: pointer; }
#prog::before, #prog::after { position: absolute; content: ''; left: 0; }
#prog::before { width: var(--posX); height: 1px; background: green; }
#prog::after { left: var(--posX); top: calc(50% - 5px); width: 3px; height: 10px; background: darkgreen; }
#lrc { --motion: cover1; --tt: 1s; --state: paused; position: absolute; right: 20px; bottom: 15px; font: bold 2.4em sans-serif; color: hsl(240,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(120,30%,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(1turn); } }
</style>

<div id="papa">
        <div id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</div>
        <div id="mplayer" data-cur="00:00" data-dur="00:00">
                <span id="prog"></span>
                <span class="btnplay"></span>
        </div>
</div>
<audio id="aud" src="https://www.qqmc.com/up/kwlink.php?id=234879034&.mp3" autoplay loop>audio api</audio>

<script>
(function() {
        let mKey = 0, mFlag = true, btnplay = document.querySelector('.btnplay');
        let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
        mplayer.onmousemove = (e) => {mplayer.style.cursor = e.offsetY > 90 ? 'pointer' : e.offsetY < 80 ? 'pointer' : 'default'; }
        mplayer.onclick = (e) => {if(e.offsetY > 90) {aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;} else if(e.offsetY < 80) {aud.paused ? aud.play() : aud.pause();}}
        aud.addEventListener('pause', () => mState());
        aud.addEventListener('play', () => mState());
        aud.addEventListener('seeked', () => calcKey());
        aud.addEventListener('timeupdate', () => {prog.style.setProperty('--posX', prog.offsetWidth * aud.currentTime / aud.duration + 'px');mplayer.dataset.cur = toMin(aud.currentTime);mplayer.dataset.dur = toMin(aud.duration);for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime >= lrcAr) {if (mKey === j) showLrc(lrcAr);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;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
        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 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; };
        papa.oncontextmenu = () => false;
        (function() {for(j=0; j<50; j++) {let leaf = document.createElement('span');leaf.className = 'btnplay';leaf.style.cssText = `left: 80%;top: 45%;transform: rotate(${Math.random() * 360}deg) translate(${Math.random() * 150}px);`;papa.appendChild(leaf);}})();
})();
</script>

红影 发表于 2022-11-3 21:49

水芙蓉美女又做出最新效果了,真棒。叶子的色彩和歌词很相配,漂亮{:4_187:}

马黑黑 发表于 2022-11-3 21:57

三叶草的颜色与背景树叶的颜色同色系,倒是有以假乱真的效果。当然,可以考虑用不同色系的

醉美水芙蓉 发表于 2022-11-3 22:09

红影 发表于 2022-11-3 21:49
水芙蓉美女又做出最新效果了,真棒。叶子的色彩和歌词很相配,漂亮

谢谢红影鼓励!

醉美水芙蓉 发表于 2022-11-3 22:10

马黑黑 发表于 2022-11-3 21:57
三叶草的颜色与背景树叶的颜色同色系,倒是有以假乱真的效果。当然,可以考虑用不同色系的

好像别的颜色配上不好看!

马黑黑 发表于 2022-11-3 22:11

醉美水芙蓉 发表于 2022-11-3 22:10
好像别的颜色配上不好看!

嗯嗯,尝试过的话,自己定夺最好

红影 发表于 2022-11-3 22:23

醉美水芙蓉 发表于 2022-11-3 22:09
谢谢红影鼓励!

客气了,问好水芙蓉{:4_204:}

相约爱晚亭 发表于 2022-11-4 07:35

欣赏音画佳作!

醉美水芙蓉 发表于 2022-11-4 11:46

相约爱晚亭 发表于 2022-11-4 07:35
欣赏音画佳作!

谢谢老师欣赏支持!

小辣椒 发表于 2022-11-5 20:48

欣赏水芙蓉的精彩制作,{:4_171:}

小辣椒 发表于 2022-11-5 20:48

这个播放器我还没有做过的,水芙蓉也是速度的{:4_178:}

醉美水芙蓉 发表于 2022-11-5 22:04

小辣椒 发表于 2022-11-5 20:48
这个播放器我还没有做过的,水芙蓉也是速度的

小辣椒会做图,肯定做得漂亮!

大猫咪 发表于 2022-11-8 20:35

浪漫温馨的画面,制作真棒!好听好看!欣赏水芙蓉的精彩制作,问好!

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

醉美水芙蓉 发表于 2022-11-9 08:04

大猫咪 发表于 2022-11-8 20:35
浪漫温馨的画面,制作真棒!好听好看!欣赏水芙蓉的精彩制作,问好!

谢谢猫咪欣赏支持!
页: [1]
查看完整版本: 爱情幸福的味道-梅朵