小辣椒 发表于 2022-10-7 23:17

爱你是那么的辛苦(学习黑黑竖歌词同步)TO:走过岁月


<style>
#papa { left: -414px; width: 1400px; height: 800px; top: 150px;background: darkred url('http://wx.ttt.dj/data/nfs/img/GIF.gif') no-repeat center/cover; display: grid; place-items: center; box-shadow: 3px 3px 20px #000; user-select: none; position: relative; z-index: 1;}
#mplayer { position: absolute; left: 1025px; bottom: 50px; width: 120px; height: 120px; border-radius: 50%; overflow: hidden; z-index: 3; }
#track { stroke: url(#gradient); }
#tmsg { fill: hsl(120,100%,60%); font: normal 1em sans-serif; }
#btnwrap { display: block; fill: hsla(0,100%,100%,.7); cursor: pointer; }
#btnwrap:hover { fill: hsla(0,60%,60%,.8); }
#lrc { --motion: cover1; --tt: 5s; --state: running; position: absolute; right: 140px; top: 120px; font: bold 2.4em sans-serif; color: hsl(20,10%,80%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(20,100%,0%,.95)); writing-mode: vertical-rl; }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(90deg,hsla(0,100%,60%,0.5),hsla(360,60%,50%,.75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); writing-mode: vertical-rl; }
@keyframes cover1 { from { width: 100%; height: 0; } to { width: 100%; height: 100%; } }
@keyframes cover2 { from { width: 100%; height: 0; } to { width: 100%; height: 100%; } }
</style>

<div id="papa">
        <div id="lrc" data-lrc="花潮論壇lrc在線">花潮論壇lrc在線</div>
        <svg id="mplayer" width="120" height="120" shape-rendering="geometricPrecision">
                <g id="mama" transform="rotate(-90, 60, 60)" style="cursor: pointer;">
                        <circle id="track" cx="60" cy="60" r="50" fill="none" stroke-width="10"/>
                        <circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="2" stroke="hsla(0,0%,90%,0.55)" />
                </g>
                <path id="curPath" d="M 20 70 Q 60 0 100 70" fill="none" stroke="none"/>
                <path id="durPath" d="M 20 55 Q 60 110 100 55" fill="none" stroke="none"/>
                <g id="tmsg">
                        <text x="34" y="0"><textPath id="curMsg" xlink:href="#curPath" dominant-baseline="text-after-edge">00:00</textPath></text>
                        <text x="29" y="0"><textPath id="durMsg" xlink:href="#durPath" dominant-baseline="text-before-edge">00:00</textPath></text>
                </g>
                <g id="btnwrap">
                        <path id="btnplay" d="M 50 50,50 70,70 60 z"></path>
                        <path id="btnmid" d="M 55 50, 55 70, 60 70, 60 50, 55 50 z" fill="transparent"></path>
                        <path id="btnpause" d="M 52 50,52 70,57 70,57 50,52 50 z M 60 50,60 70,65 70,65 50,60 50 z"></path>
                </g>
                <defs>
                        <linearGradient id="gradient" x1="0" y1="0" x2="1" y2="1">
                                <stop offset="0%" stop-color="orange" stop-opacity="0.6" />
                                <stop offset="35%" stop-color="green" stop-opacity="0.6" />
                                <stop offset="65%" stop-color="magenta" stop-opacity="0.6" />
                                <stop offset="100%" stop-color="darkblue" stop-opacity="0.6" />
                        </linearGradient>
                </defs>
        </svg>
</div>

<script>
let mKey = 0, mFlag = true, aud = new Audio(), cc = { x: 1*track.getAttribute('cx'), y: 1*track.getAttribute('cy'), len: track.getTotalLength(), };
let lrcAr = [
                ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ];
aud.src = 'http://wx.ttt.dj/data/nfs/mp3/ansnmxk.mp3';
aud.autoplay = true;
aud.loop = true;
prog.style.strokeDasharray = prog.style.strokeDashoffset = cc.len;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('seeked', () => calcKey());
mama.onclick = (e) => {let deg = Math.atan2(e.offsetY - cc.y, e.offsetX - cc.x) * 180 / Math.PI;deg += (e.offsetX < cc.x && e.offsetY < cc.y) ? 450 : 90;aud.currentTime = aud.duration * deg / 360;};
aud.addEventListener('pause', () => mState());
aud.addEventListener('play',() => mState());
aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration + 'px';curMsg.textContent = toMin(aud.currentTime);durMsg.textContent = 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.setProperty('--state', 'paused')) : (btnplay.style.display = 'none', btnpause.style.display = 'block', 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;}
mState();
</script>
<br><br><br><br><br><br><br><br><br><br><br><br>

小辣椒 发表于 2022-10-7 23:18

@马黑黑

黑黑,学习一个竖歌词同步,我改了单字的效果

小辣椒 发表于 2022-10-7 23:20

@走过岁月

谢谢岁月的礼物,小辣椒今天看见黑黑的竖歌词同步就做了个效果,感谢岁月~~~

马黑黑 发表于 2022-10-7 23:23

小辣椒 发表于 2022-10-7 23:18
@马黑黑

黑黑,学习一个竖歌词同步,我改了单字的效果

效果非常好

马黑黑 发表于 2022-10-7 23:23

岁月的粒子用上的,很漂亮

小辣椒 发表于 2022-10-7 23:26

马黑黑 发表于 2022-10-7 23:23
效果非常好

我是晚上上来看见你的竖歌词,刚好可以用一下,顺便完成作业

小辣椒 发表于 2022-10-7 23:26

马黑黑 发表于 2022-10-7 23:23
岁月的粒子用上的,很漂亮
就做了一个动图。下午睡觉前完成的

风中飞尘 发表于 2022-10-7 23:37

{:4_189:}

风中飞尘 发表于 2022-10-7 23:38

好听,,带劲{:4_196:}

小辣椒 发表于 2022-10-7 23:41

风中飞尘 发表于 2022-10-7 23:38
好听,,带劲

哈哈~~~你的音乐只是你的无损我压缩了现在才128KB

马黑黑 发表于 2022-10-8 07:14

小辣椒 发表于 2022-10-7 23:26
就做了一个动图。下午睡觉前完成的

分步骤制作,这是正确的法子

马黑黑 发表于 2022-10-8 07:15

小辣椒 发表于 2022-10-7 23:26
我是晚上上来看见你的竖歌词,刚好可以用一下,顺便完成作业

晚上是第二个步骤

樵歌 发表于 2022-10-8 07:39

太劲道,看着激情奔放。小辣椒太厉害了!{:4_178:}

红影 发表于 2022-10-8 08:47

亲爱的在岁月效果里加个跳舞小人,这个设想真不错。帖子漂亮{:4_199:}

红影 发表于 2022-10-8 08:50

岁月的这个粒子也是环形为主,所以圆环播放器倒是正好相映成趣{:4_187:}

梦油 发表于 2022-10-8 10:08

这伴奏的音乐倒是挺潮的,真棒!真棒!!

相约爱晚亭 发表于 2022-10-8 10:34

欣赏音画佳作!

加林森 发表于 2022-10-8 12:17

真好看。也好听!{:4_199:}

走过岁月 发表于 2022-10-8 13:53

来收礼,谢谢小辣椒

小辣椒 发表于 2022-10-8 20:53

马黑黑 发表于 2022-10-8 07:14
分步骤制作,这是正确的法子

主要最近这个情况。我一般做帖都是一口气完成{:4_173:}习惯了
页: [1] 2 3 4 5
查看完整版本: 爱你是那么的辛苦(学习黑黑竖歌词同步)TO:走过岁月