岩新新 发表于 2023-7-3 10:55

张宇---雨一直下

本帖最后由 岩新新 于 2023-7-3 10:59 编辑 <br /><br /><div class="t_fsz">
<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_1915455">
<i class="pstatus"></i><br /><br /><style>
#mydiv {
        margin: 40px 0 0 calc(50% - 651px);
        width: 1140px;
        height: 640px;
        background: url('https://i.mp3.wf/view.php/5e807763a650177a99d0c0a8c0ed8939.gif');
        box-shadow: 0 0 8px 0 #000;
        display: grid;
        place-items: center;
        position: relative;
        z-index: 1;
}
#lrc {
        position: absolute;
        width: fit-content;
        height: fit-content;
        top: 5%;
        font: bold 2.4em Sans-serif;
        color: #fff;
        text-shadow: 1px 1px 2px #000;
        white-space: pre;
        display: inherit;
        place-items: inherit;
        user-select: none;
        --state: paused; --motion: cover2; --tt: 2s;
}
#lrc::before, #lrc::after { position: absolute; content: ''; cursor: pointer; }
#lrc::before {
        content: attr(data-lrc);
        width: 100%;
        height: 100%;
        white-space: pre;
        width: 0;
        left: 0;
        color: orange;
        overflow: hidden;
        animation: var(--motion) var(--tt) linear forwards var(--state);
}
#lrc::after {
        width: 50px;
        height: 50px;
        bottom: -60px;
        background: red;
        border-radius: 0%;
        opacity: .7;
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
        animation: rot 6s infinite linear var(--state);
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(360deg); } }
</style>

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

<script>
(function() {
        let mKey = 0, mFlag = true, slip = 0;
        let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
        let mState = () => lrc.style.setProperty('--state', aud.paused ? 'paused' : '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); };
        aud.addEventListener('timeupdate', () => {for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime - slip >= lrcAr) {cKey = j;if (mKey === j) showLrc(lrcAr);else continue;}}});
        aud.addEventListener('play', mState, false);
        aud.addEventListener('pause', mState, false);
        aud.addEventListener('seeked', () => calcKey());
        lrc.onclick = () => aud.paused ? aud.play() : aud.pause();
})();
</script>
</td></tr></table>

红影 发表于 2023-7-3 12:32

这动图有趣,好像雨下出了烟花效果呢。欣赏新新好帖{:4_187:}

小辣椒 发表于 2023-7-3 18:37

谢谢岩新新分享{:4_187:}

小文 发表于 2023-7-3 19:23

雨一直下……喜欢

岩新新 发表于 2023-7-3 19:46

红影 发表于 2023-7-3 12:32
这动图有趣,好像雨下出了烟花效果呢。欣赏新新好帖

谢谢欣赏!

岩新新 发表于 2023-7-3 19:46

小文 发表于 2023-7-3 19:23
雨一直下……喜欢

谢谢欣赏!

岩新新 发表于 2023-7-3 19:47

小辣椒 发表于 2023-7-3 18:37
谢谢岩新新分享

谢谢欣赏!

红影 发表于 2023-7-3 21:19

岩新新 发表于 2023-7-3 19:46
谢谢欣赏!

问好新新,晚上好。{:4_187:}

梦缘 发表于 2023-7-4 11:01

欣赏精彩佳作,谢谢分享,点赞!{:4_171:}
页: [1]
查看完整版本: 张宇---雨一直下