小辣椒 发表于 2023-8-25 20:51

爱你是那么的辛苦 TO:老头

<style>
#papa { left: -390px;top: 150px; width: 1346px; height: 783px; background: darkred url('https://wj.zp68.com/lxx/yunhua/2023/08/25/bj.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: 1160px; bottom: 80px; 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: 100px; top: 120px; font: bold 2.2em sans-serif; color: hsl(20,10%,80%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 1px 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(120,100%,60%,0.5),hsla(120,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 style="position: absolute;left: 74px;top:60px; width:300px;">
                <img alt="" src="https://wj.zp68.com/lxx/yunhua/2023/08/25/hua.gif"/>
                </div>
<div style="position: absolute;left: 704px;top:160px;width:32px; height: 32px; ">
                <img alt="" src="https://wj.zp68.com/lxx/yunhua/2023/08/25/xx.gif"/>
                </div>

        <div id="lrc" data-lrc="HCPLAYER">HCPLAYER</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 = 'https://wj.zp68.com/lxx/yunhua/2023/08/25/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>

小辣椒 发表于 2023-8-25 20:52

@东篱闲人

老头送个美女,送首暧昧的歌{:4_170:}

小辣椒 发表于 2023-8-25 20:54

@马黑黑

黑黑继续复习前面学习过的播放器,这个彩色的圆播放器非常喜欢的,竖歌词也是另外一种效果。{:4_187:}

马黑黑 发表于 2023-8-25 21:01

做的很用心

梦油 发表于 2023-8-25 21:06

嗬,够 “潮” 的啊!{:5_116:}

醉美水芙蓉 发表于 2023-8-25 21:12

红影 发表于 2023-8-25 22:07

这个动图好漂亮,美女的裙子也是会动的呢,仿佛微风吹拂。欣赏亲爱的好制作,东篱大哥收礼开心{:4_199:}

东篱闲人 发表于 2023-8-25 22:24

还有礼物。。。。{:4_187:}

东篱闲人 发表于 2023-8-25 22:25

小辣椒 发表于 2023-8-25 20:52
@东篱闲人

老头送个美女,送首暧昧的歌

谢谢师傅,这美女好,够斤称。。。。{:5_116:}
页: [1]
查看完整版本: 爱你是那么的辛苦 TO:老头