醉美水芙蓉 发表于 2022-9-23 21:59

错的是你伤的是我

<style>
        #papa { left: -214px; width: 1024px; height: 640px; background: url('https://pic.imgdb.cn/item/632dbacf16f2c2beb1d8790f.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; box-shadow: 3px 3px 20px #000; display: flex; justify-content: center; overflow: hidden; position: relative; z-index: 1; }
        #mplayer { position: absolute; bottom: 4px; width: 240px; 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, snow, darkgreen); opacity: 1; }
        #btnwrap, #prog { position: absolute; display: grid; place-items: center; transition: .5s; }
        #btnwrap { --yy: -15px; width: 40px; height: 40px; border-radius: 50%; border: 4px solid lightgreen; opacity: 0.1;}
        #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: 240px; height: 18px; border-radius: 10px; background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,0,0,.75) 70%, transparent 0); border: 1px solid lightgreen; font: normal 14px/18px sans-serif; color: snow; }
        #lrc { position: absolute; top: 510px; font: bold 2.4em sans-serif; color: transparent; background-image: linear-gradient(45deg, #0f0 0%, #ccc 30%, #00B4F1 0%, #00B4F1 70%, #ccc 0%, #f00 100%);
                background-size: 35% 100%;
                -webkit-background-clip: text;
                background-clip: text;
                color:transparent;
                              text-align: center;
                /*background-position: 0% 100%;*/
                animation: aitf 5s linear infinite;
      }
      @keyframes aitf {
                0% { background-position: 0% 50%; }
                100% { background-position: 100% 50%; }
      }
      @keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
        @keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
</style>

<div id="papa">
        <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 = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
let mKey = 0, mFlag = true, aud = new Audio();

prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.src = 'https://www.qqmc.com/up/kwlink.php?id=240217683&.mp3';
aud.autoplay = true;
aud.loop = true;

btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();

aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());

aud.addEventListener('timeupdate', () => {
        prog.style.background= 'linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,0,0,.75) ' + aud.currentTime / aud.duration * 100 + '%, transparent 0)';
        prog.innerText = toMin(aud.currentTime) + ' | ' + 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.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;
        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 mtime = lrcAr - (aud.currentTime - lrcAr);
        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>

马黑黑 发表于 2022-9-23 22:26

欣赏新效果

醉美水芙蓉 发表于 2022-9-23 22:26

马黑黑 发表于 2022-9-23 22:26
欣赏新效果

跟着黑黑老师学了一个字体!

马黑黑 发表于 2022-9-23 22:27

醉美水芙蓉 发表于 2022-9-23 22:26
跟着黑黑老师学了一个字体!

这个是你自己找到的

醉美水芙蓉 发表于 2022-9-23 22:29

马黑黑 发表于 2022-9-23 22:27
这个是你自己找到的

还是黑黑老师的功劳,我可不会代码制作!

马黑黑 发表于 2022-9-23 22:31

醉美水芙蓉 发表于 2022-9-23 22:29
还是黑黑老师的功劳,我可不会代码制作!

会用就行的

红影 发表于 2022-9-24 09:14

这个真漂亮,水芙蓉美女把那个闪光字歌词用到帖子里了,效果很好。欣赏水芙蓉好帖{:4_199:}

亚伦影音工作室 发表于 2022-9-24 09:50

歌词花样漂亮!

醉美水芙蓉 发表于 2022-9-24 17:12

红影 发表于 2022-9-24 09:14
这个真漂亮,水芙蓉美女把那个闪光字歌词用到帖子里了,效果很好。欣赏水芙蓉好帖

谢谢红影光临支持!

醉美水芙蓉 发表于 2022-9-24 17:13

亚伦影音工作室 发表于 2022-9-24 09:50
歌词花样漂亮!

谢谢亚伦老师光临支持!

红影 发表于 2022-9-24 20:08

醉美水芙蓉 发表于 2022-9-24 17:12
谢谢红影光临支持!

水芙蓉美女真棒,点赞{:4_187:}
页: [1]
查看完整版本: 错的是你伤的是我