马黑黑 发表于 2022-11-12 07:22

只爱我自己

<style>
#papa { margin: 120px 0 0 calc(50% - 621px); display: grid; place-items: center; width: 1080px; height: 720px; background: #000 url('https://638183.freep.cn/638183/t22/webp/541.webp') no-repeat center/cover; box-shadow: 3px 3px 20px #000; perspective: 1000px; overflow: hidden; user-select: none; position: relative; z-index: 1; }
#mplayer { position: absolute; top: 400px; right: 220px; z-index: 1000; }
#btnwrap { display: block; fill: hsla(30, 20%, 80%, .9); cursor: pointer; }
#btnwrap:hover { fill: hsla(90, 100%, 100%, .9); }
#tmsg { fill: hsla(30, 100%, 90%, .9); stroke: none; font: bold 1em sans-serif; }
#lrc { --motion: cover1; --tt: 1s; --state: running; position: absolute; top: 25px; font: bold 2.4em sans-serif; color: hsl(100,100%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,100%,0%,.85)); z-index: 900; }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(19, 48%, 22%,.35),hsla(19, 28%, 42%,.65)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
.heart { position: absolute; top: 0; width: 40px; height: 40px; display: grid; place-items: center; font: normal 40px sans-serif; color: red; offset-path: path('m271.44526,175.38086c65.55493,-161.83822 322.4013,0 0,208.07771c-322.4013,-208.07771 -65.55493,-369.91593 0,-208.07771z'); offset-distance: 10%; }
@keyframes move { to { transform: rotate(0) translate3d(0, 0, 0); } }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
</style>

<div id="papa">
        <svg id="mplayer" width="120" height="120">
                <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" stroke="hsla(100, 20%, 80%, .65)" />
                        <circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="hsla(100,50%,50%,.55)" />
                </g>
                <g id="btnwrap">
                        <path id="btnplay" d="M 50 50,50 70,70, 60 z"></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" style="display: none;"></path>
                        <path d="M 57 50,60 50,60 70,57 70 z" fill="transparent" />
                </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>
        </svg>
        <div id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1996577914.mp3" loop autoplay></audio>

<script>
        (function() {(function() {let total = 20, ww = 40;Array.from({length: total}).forEach((item,key) => {item = document.createElement('span');item.className = 'heart';item.innerText = '\u2764';item.style.cssText += `color: #${Math.random().toString(16).substr(-6)};offset-distance: ${100/total*key}%;opacity: Math.random()*0.5 + 0.4;`;papa.appendChild(item);});})();
        let mKey = 0, mFlag = true, cc = { x: 1*track.getAttribute('cx'), y: 1*track.getAttribute('cy'), len: track.getTotalLength(),};
        let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
        prog.style.strokeDasharray = prog.style.strokeDashoffset =cc.len;
        btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
        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('seeked', () => calcKey());
        aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;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 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 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 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-11-12 07:57

马黑黑 发表于 2022-11-12 08:31

醉美水芙蓉 发表于 2022-11-12 07:57
黑黑老师好早呀!欣赏老师精美音画!爱心很漂亮!

心形的制作,可以参考这里:

https://www.huachaowang.com/forum.php?mod=viewthread&tid=64536

梦油 发表于 2022-11-12 09:13

黑黑朋友早晨好!欣赏佳作,问候朋友。

梦缘 发表于 2022-11-12 10:19

感谢老师的精彩分享,欣赏问好!{:4_176:}

小辣椒 发表于 2022-11-12 11:37

黑黑辛苦,一早就发了新的制作{:4_187:}

小辣椒 发表于 2022-11-12 11:37

这星星好像和上次的路径星星不一样的

小辣椒 发表于 2022-11-12 11:38

这个星星要学习做一次

马黑黑 发表于 2022-11-12 12:03

梦油 发表于 2022-11-12 09:13
黑黑朋友早晨好!欣赏佳作,问候朋友。

感谢梦油先生支持

马黑黑 发表于 2022-11-12 12:03

小辣椒 发表于 2022-11-12 11:38
这个星星要学习做一次

挺漂亮的吧

马黑黑 发表于 2022-11-12 12:04

小辣椒 发表于 2022-11-12 11:37
这星星好像和上次的路径星星不一样的

这是AI生成的

马黑黑 发表于 2022-11-12 12:04

梦缘 发表于 2022-11-12 10:19
感谢老师的精彩分享,欣赏问好!

感谢支持

马黑黑 发表于 2022-11-12 12:04

小辣椒 发表于 2022-11-12 11:37
黑黑辛苦,一早就发了新的制作

这个简单简洁的没多少元素

小辣椒 发表于 2022-11-12 13:38

马黑黑 发表于 2022-11-12 12:04
这个简单简洁的没多少元素

我完成了,也是不错的效果{:4_199:}

小辣椒 发表于 2022-11-12 13:39

马黑黑 发表于 2022-11-12 12:04
这是AI生成的

反正我套用

小辣椒 发表于 2022-11-12 13:39

马黑黑 发表于 2022-11-12 12:03
挺漂亮的吧

是的,我感觉彩色星星特别漂亮

马黑黑 发表于 2022-11-12 14:18

小辣椒 发表于 2022-11-12 13:39
是的,我感觉彩色星星特别漂亮

也要看场景的

马黑黑 发表于 2022-11-12 14:19

小辣椒 发表于 2022-11-12 13:38
我完成了,也是不错的效果

看到了,很精致、漂亮

马黑黑 发表于 2022-11-12 14:20

小辣椒 发表于 2022-11-12 13:39
反正我套用

路径,道理上应根据自己的帖子尺寸生成,找找网上的工具,很容易制作的

梦油 发表于 2022-11-12 15:15

马黑黑 发表于 2022-11-12 12:03
感谢梦油先生支持

黑黑先生别客气。
页: [1] 2 3
查看完整版本: 只爱我自己