翁奕童苑 发表于 2022-9-27 09:02

《巴山夜雨》演唱/陈思

本帖最后由 翁奕童苑 于 2022-9-27 18:02 编辑 <br /><br /><p></p>

<style>
        #papa { left: -180px; width: 960px; height: 600px; background: url('0') no-repeat center/cover; box-shadow: 0px 0px 4px #ff0; box-shadow: 0px 0px 5px #f00; display: flex; justify-content: center; overflow: hidden; hidden;border-radius:6%;position: relative; z-index: 1; }
        #mplayer { position: absolute; bottom: 10px; right:280px; width: 40px; 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, #000, #607E6C); 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: 100px; height: 18px; border-radius: 10px; background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(60,179,113,.75) 70%, transparent 0); border: 1px solid lightgreen; font: normal 14px/18px sans-serif; color: snow; }
        #lrc { position: absolute; top: 480px; font: bold 2.5em sans-serif;font-family:宋体; filter:drop-shadow(#FFFfff 1px 0 0)drop-shadow(#FFFfff 0 1px 0)drop-shadow(#FFFfff -1px 0 0) drop-shadow(#FFFfff 0 -1px0);color: transparent; letter-spacing: 2px; background: linear-gradient(45deg, #012BFA 21%,#F60303 75%) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
        @keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
        @keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
        #yanqun { position: absolute; left: 170px; top: 0px; opacity: .5; }
      .wenzi { position: absolute; top: 400px; right:180px; z-index: 10; }
.text {animation: stroke 5s infinite alternate;letter-spacing: 10px;font-size: 150px;}
@keyframes stroke {
0% {fill: rgba(72, 138, 20, 0);stroke: rgba(96, 126, 108, 1);stroke-dashoffset: 25%;stroke-dasharray: 0 50%;stroke-width: 1;}
70% {fill: rgba(72, 138, 20, 0);stroke: rgba(96, 126, 108, 1);stroke-width: 3;}
90%,100% {fill: rgba(104, 135, 117, 0.8);stroke: rgba(96, 126, 108, 0);stroke-dashoffset: -25%;stroke-dasharray: 50% 0;stroke-width: 0;}}
</style>
<div id="papa">
        <video autoplay="autoplay" height="630" loop="loop" muted="true" src="https://img.tukuppt.com/video_show/2418175/00/17/83/5ecfd76873a5a.mp4"style="width:990px;height:600px; auto;filter:contrast(120%);opacity:1.0;transform: scale(1, 1.1)" width="990">&nbsp;</video>
        <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 style="position: absolute; width: 413px; height: 136px; z-index: 20; left: 550px; top: 20px" id="layer3">
        <p align="center"><strong><font face="宋体" size="6" face="翁奕童苑" color="#ff0000">《巴山夜雨》</font></strong></p>
        <p align="center"><strong><font face="宋体" size="4" color="#ff00ff">演唱/陈思 编辑/翁奕童苑</font></strong></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=95549682.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(60,179,113,.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-27 12:38

问好翁奕童苑,制作不错{:4_178:}

马黑黑 发表于 2022-9-27 12:40

这歌很抒情。制作很优美雅致。赞。

加林森 发表于 2022-9-27 13:28

制作挺漂亮的。歌曲很抒情。赞!{:4_199:}

红影 发表于 2022-9-27 16:33

不明白,您直接使用了“有声有色”送我的动图,是否应该标注和感谢一下“有声有色”?

小辣椒 发表于 2022-9-27 16:35

你这个是纯套用代码制作,图图也是别人的,不好意思,精华取消了,

希望楼主再接再厉,尽量自己原创的出来。当然播放器可以学习黒黑的制作。

加油!

红影 发表于 2022-9-27 16:41

不太赞同这样直接使用其他人的制作直接换个歌曲的做法,最好有点自己的东西,这样才能更好地学习。{:4_204:}
页: [1]
查看完整版本: 《巴山夜雨》演唱/陈思