小辣椒 发表于 2023-4-8 16:32

云雾山间(学习黑黑茉莉花播放器效果)


<style>
#papa { margin: 150px -410px; width: 1400px; height: 711px; background: lightblue url('https://xlaj.cn/assets/file/zp/20230408162533.jpg') center/cover no-repeat; box-shadow: 3px 3px 20px #000; position: relative; z-index: 1; }
#lrc { position: absolute; left: 45%; top: 60px; transform: translate(-50%); height: 50px; font: bold 40px/50px sans-serif; background: transparent; color: gray; display: grid; place-items: center start; pointer-events: none;--motion: cover2; --state: running; --tt: 1s; }
#lrc::before, #lrc::after { position: absolute; content: ''; }
#lrc::before { content: attr(data-lrc); width: 0%; height: 100%; color: green; white-space: pre; overflow: hidden; animation: var(--motion) var(--tt) linear forwards var(--state); }
#lrc::after { width: 50px; height: 50px; left: -100px; border-radius: 50%; background: url('https://xlaj.cn/assets/file/zp/20230408162600.png') center/cover no-repeat; cursor: pointer; pointer-events: auto; animation: rot 4s infinite linear var(--state); }
#svg { position: absolute; font: bold 6em sans-serif; }
.text { fill: none; stroke-width: 3; stroke-dasharray: 0 300; stroke-dashoffset: 0; }
.text:nth-child(3n + 1) { stroke: Gray; animation: stroke1 30s ease-in-out infinite alternate; }
.text:nth-child(3n + 2) { stroke:         orange; animation: stroke2 30s ease-in-out infinite alternate; }
.text:nth-child(3n + 3) { stroke: Teal; animation: stroke3 30s ease-in-out infinite alternate; }
.text:hover { fill: teal; opacity: .45; }

@keyframes stroke1 { to { stroke-dashoffset: 1000; stroke-dasharray: 80 160; } }
@keyframes stroke2 { to { stroke-dashoffset: 1080; stroke-dasharray: 80 160; } }
@keyframes stroke3 { to { stroke-dashoffset: 1160; stroke-dasharray: 80 160; } }
@keyframes cover1 { to { width: 100%; } }
@keyframes cover2 { to { width: 100%; } }
@keyframes rot { to { transform: rotate(360deg); } }
#dt1{ position: absolute; width: 600px; height: 400px; top:200px;; left: 780px; }

</style>

<div id="papa">
        <svg id="svg" width="1400" height="800">
                <symbol id="s-text"><text text-anchor="middle" x="70%" y="75%" dy=".25em">云雾山间</text></symbol>
                <use xlink:href="#s-text" class="text"></use>
                <use xlink:href="#s-text" class="text"></use>
                <use xlink:href="#s-text" class="text"></use>

<img id="dt1" src="https://xlaj.cn/assets/file/zp/20230408162718.gif" alt="" />


      <div id="lrc" data-lrc="HCPlayer">HCPlayer</div>
</div>
<audio id="aud" src="http://music.163.com/song/media/outer/url?id=1949087277.mp3" autoplay="autoplay" loop="loop"></audio>

<script>
let mKey = 0, mFlag = true;
let lrcAr = [
                ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
let mState = () => lrc.style.setProperty('--state', aud.paused ? 'paused' : 'running');
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrcAr;lrc.dataset.lrc = lrcAr.replace(/<br>/, '\n');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);};
aud.addEventListener('timeupdate', () => {for(let j = 0; j < lrcAr.length; j ++) {if (aud.currentTime >= lrcAr) {if (mKey === j) showLrc(lrcAr);else continue;}}});
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
lrc.onclick = () => aud.paused ? aud.play() :aud.pause();
</script>

小辣椒 发表于 2023-4-8 16:34

@马黑黑

黑黑都好久没有好好做作业了{:4_189:}

今天学习套一个

梦油 发表于 2023-4-8 16:59

“云雾山间”四个字真漂亮。

小辣椒 发表于 2023-4-8 17:14

梦油 发表于 2023-4-8 16:59
“云雾山间”四个字真漂亮。

梦油好,谢谢欣赏{:4_187:}

焱鑫磊 发表于 2023-4-8 17:21

欣赏小辣椒佳作!{:4_187:}

马黑黑 发表于 2023-4-8 17:40

淡雅之美,耐看。欣赏。

梦油 发表于 2023-4-8 18:14

小辣椒 发表于 2023-4-8 17:14
梦油好,谢谢欣赏

你做得真好。

庶民 发表于 2023-4-8 18:25

有底蕴的帖子。

雨中悄然 发表于 2023-4-8 18:35

点开贴子眼前一亮,太美了。。。{:4_187:}

雨中悄然 发表于 2023-4-8 18:36

标题字彩色蚂蚁线颜色可以改得哦,跟贴子主色调特别配{:4_199:}又学到了

小辣椒 发表于 2023-4-8 19:57

焱鑫磊 发表于 2023-4-8 17:21
欣赏小辣椒佳作!

问好焱鑫磊,谢谢欣赏{:4_187:}

小辣椒 发表于 2023-4-8 19:57

马黑黑 发表于 2023-4-8 17:40
淡雅之美,耐看。欣赏。

谢谢黑黑教程分享{:4_187:}

小辣椒 发表于 2023-4-8 19:58

梦油 发表于 2023-4-8 18:14
你做得真好。

是黑黑的教程好,小辣椒是完成作业{:4_173:}

小辣椒 发表于 2023-4-8 19:59

庶民 发表于 2023-4-8 18:25
有底蕴的帖子。

啊~~~庶民什么底蕴啊,谢谢欣赏{:4_189:}

小辣椒 发表于 2023-4-8 19:59

雨中悄然 发表于 2023-4-8 18:35
点开贴子眼前一亮,太美了。。。

悄然晚上好~~谢谢欣赏{:4_187:}

小辣椒 发表于 2023-4-8 20:00

雨中悄然 发表于 2023-4-8 18:36
标题字彩色蚂蚁线颜色可以改得哦,跟贴子主色调特别配又学到了

悄然谦虚了,这个有色码的,修改你应该没有问题的

梦油 发表于 2023-4-8 20:24

小辣椒 发表于 2023-4-8 19:58
是黑黑的教程好,小辣椒是完成作业

这个作业打满分。

小辣椒 发表于 2023-4-8 20:33

梦油 发表于 2023-4-8 20:24
这个作业打满分。

谢谢梦油鼓励,小辣椒还需多努力

马黑黑 发表于 2023-4-8 20:34

小辣椒 发表于 2023-4-8 19:57
谢谢黑黑教程分享

客气了{:4_190:}

亦是金 发表于 2023-4-8 20:49

帖子好看,耐看,标题文字显示好看!学习了!{:4_187:}
页: [1] 2 3
查看完整版本: 云雾山间(学习黑黑茉莉花播放器效果)