岩新新 发表于 2023-6-25 21:37

张玮伽 - 谁为我停留

本帖最后由 岩新新 于 2023-6-25 22:18 编辑 <br /><br /><div class="t_fsz">
<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_1911070">
<style>
#papa {
      margin: 80px 0 0 calc(50% - 593px);
      width: 1024px;
      height: 620px;
      background: lightblue url('https://pan.111t.net/view.php/45a9cdc3e07cf7d0fb2bb9ecbbd7a8c4.gif') no-repeat center / cover;
      box-shadow: 3px 3px 20px #000;
      position: relative; overflow: hidden;
      z-index: 1;
      --state: paused;
}
#pic {
        position: absolute;
        left: 150px;
        top: 210px;
        width: 180px;
        height: 180px;
        opacity: .85;
        z-index: 10;
}

</style>
<div id="papa">
<img id="pic" src="https://pan.111t.net/view.php/d88a161b163e29afa1dd2a18a203fba2.gif" alt="" />
<css-doodle grid="7x1" id="mplayer">
        :doodle {
                @size: 1024px 600px;
                display: block;
                opacity: .95;
                position: absolute;
                z-index: 1;       
                --geci: 'HUACHAO';
                --motion: cover2;
                --ww: 300px;
                --prog: 0;
                --tt: 1s;
                --tt1: '00:00';
                --tt2: '00:00';
                --xplace: 25%;
                --yplace: 98%;
                --color: Navy;
                --state: paused;
        }
        position: absolute;
        @nth(1) { /* 歌词 */
                @size: auto 3em;
                @place: 50% 10%;
                transform: translate(-50%);
                display: grid;
                place-items: center start;
                :before, :after {
                        content: var(--geci);
                        width: fit-content;
                        height: fit-content;
                        font: bold 2.5em Sans-serif;
                        color: #ccc;
                        text-shadow: 1px 1px 2px #000;
                        white-space: pre;
                }
                :after {
                        position: absolute;
                        white-space: pre;
                        width: 0;
                        color: HotPink;
                        overflow: hidden;
                        animation: var(--motion) var(--tt) linear forwards var(--state);
                }
        }
        @nth(2) { /* 进度条 */
                @size: var(--ww) 2px;
                @place: var(--xplace) calc(var(--yplace) - 10px);
                background: silver;
                :before, :after { content: ''; }
                :before {
                        position: absolute;
                        left: 0;
                        width: var(--prog);
                        height: 100%;
                        background: var(--color);
                }
                :after {
                        width: 100%;
                        height: 10px;
                        cursor: pointer;
                }
        }
        @nth(3) { /* 按钮 */
                @size: 60px;
                @place: var(--xplace) calc(var(--yplace) - 52px);
                cursor: pointer;
                animation: rot 6s infinite linear var(--state);
                :after {
                        content: '';
                        @size: inherit;
                        @shape: clover 5;
                        background: var(--color);
                }
        }
        @nth(4) { /* 播放时间 */
                @size: var(--ww) 20px;
                @place: var(--xplace) calc(var(--yplace) - 30px);
                :before, :after{
                        position: absolute;
                        width: 100%;
                        height: 100%;
                        color: var(--color);
                }
                :before { content: var(--tt1); }
                :after { content: var(--tt2); text-align: right; }
        }
        @match(i ≥ 5) { /* 飞行物 */
                @size: 200px 113px;
                @place: 50px 44px;
                background: url('https://638183.freep.cn/638183/Pic/2022/btf.gif');
                offset-path: path('M0 100 Q510 200 1150 100');
                offset-distance: 0%;
                animation: fly 40s calc(@r(30) * -3s) 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); } }
        @keyframes fly { to { offset-distance: 100%; }}
</css-doodle>
<css-doodle grid="16x1" id="zi">
        :doodle {
                @size:1024px 600px;
                position: absolute;
        }
        @size: 40px;
        @place: 30px 260px;
        font: bold 30px sans-serif;
        font-shadow: 1px 1px 2px #000;
        color: RoyalBlue;
        :after { content: ''; }
        offset-path: path('M80 100 a160 70 0 1 1 320 0 a170 70 0 1 1 -320 0z');
        <!-- offset-distance: calc(100 / @size * (@i - 1) * 1%); -->
        offset-rotate: 0deg;
        animation: move 12s infinite linear var(--state);
        @keyframes move {
                from { offset-distance: calc(100% / @size * (@i - 1) + 100%); }
                to { offset-distance: calc(100% / @size * (@i - 1)); }
        }
</css-doodle>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=26455136" autoplay="autoplay" loop="loop"></audio>

<script>
(function(){
        let script = document.createElement('script');
        script.src = 'https://638183.freep.cn/638183/web/api/css-doodle.js';
        document.head.appendChild(script);
        let mKey = 0, mFlag = true, slip = 0.6;
        let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
        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;};
        let mState = () => aud.paused ? (mplayer.style.setProperty('--state', 'paused'),zi.style.setProperty('--state', 'paused') ) :

(mplayer.style.setProperty('--state','running'),zi.style.setProperty('--state', 'running'));
        let showLrc = (time) => {mplayer.style.setProperty('--motion', mFlag ? 'cover1' : 'cover2');mplayer.style.setProperty('--geci', '"' + lrcAr

+ '"');mplayer.style.setProperty('--tt', time + 's');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;}}mplayer.style.setProperty('--prog', 100*aud.currentTime/aud.duration + '%');mplayer.style.setProperty('--tt1',

`'${toMin(aud.currentTime)}'`);mplayer.style.setProperty('--tt2', `'${toMin(aud.duration)}'`);});
        aud.addEventListener('play', mState, false);
        aud.addEventListener('pause', mState, false);
        aud.addEventListener('seeked', () => calcKey());
        window.onload = () => {
                let btns = mplayer.shadowRoot.querySelectorAll('cell');
                let ww = parseInt(window.getComputedStyle(mplayer).getPropertyValue('--ww'));
                btns.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / ww;
                btns.onclick = () => aud.paused ? aud.play() : aud.pause();
        }
})();
</script></td></tr></table>

红影 发表于 2023-6-25 23:18

好听的歌儿,还是头一次听呢。制作很漂亮,欣赏新新好帖{:4_187:}

醉美水芙蓉 发表于 2023-6-25 23:19

梦缘 发表于 2023-6-26 20:56

问好老师,欣赏精彩佳作,谢谢分享!{:4_187:}
页: [1]
查看完整版本: 张玮伽 - 谁为我停留