焱鑫磊 发表于 2023-5-22 14:31

《离不开你》黄绮珊(改编)

本帖最后由 焱鑫磊 于 2023-5-22 14:33 编辑 <br /><br /><style>
#papa {margin: 100px 0 0 calc(50% - 660px);width: 1164px;height: 640px;background: tan url('https://img.fy6b.com/2023/04/06/d19faabe2ebe1.gif');box-shadow: 0 0 8px #000;display: grid;place-items: center;position: relative;--state: paused;}
css-doodle{position: absolute;}
.shou {
        position: absolute;
        left: 395px;
        top: 227px;
        width: 82px;
        height: 167px;
      transform: rotate(16deg);
        opacity: 1;
        transform-origin: 0 100%;
        animation: bai 3s ease infinite alternate;
}
@keyframes bai {
        100% { transform: rotate(-6deg); }
}
</style>

<div id="papa">
<css-doodle grid="1" id="mplayer">
        :doodle {
                @size: 1024px 600px;
                z-index: 1;
               
        }
        @size: 100px;
        clip-path: @shape(
                points: 480;
                scale: .3;
                move: 0 .35;
                x: sin(t) + sin(6t) + tan.sin(2t);
                y: cos(t) + cos(5t) + tan.cos(8t);
        );
        position: absolute;
transform: rotate(90deg);
        background: DarkBlue;
        offset-path: path('M412 100Q512 0,712 100 T900 100Q700 0,600 100 T400 100');
        animation: move 20s infinite linear var(--state);
        cursor: pointer;
        @keyframes move { to { offset-distance: 100%;} }
</css-doodle>
        <css-doodle id="lrc">
                :doodle {
                        @size: auto 4em;
                        top: 20px; left: 60px;
                        --geci: "花潮lrc在线"; --motion: cover2; --tt: 1s;
                }
                /* 单元格两个伪元素显示lrc歌词 */
                display: grid;
                place-items: center start;
                :before, :after {
                        content: var(--geci);
                        color: snow; /* 歌词底色 */
                        font: bold 2em sans-serif;
                        text-shadow: 1px 1px 2px #000;
                        white-space: pre;
               }
                :after {
                        position: absolute;
                        width: 0;
                        color: MediumSlateBlue; /* 同步歌词颜色 */
                        overflow: hidden;
                        animation: var(--motion) var(--tt) linear forwards var(--state);
                }
                @keyframes cover1 { from { width: 0; } to { width: 100%; } }
                @keyframes cover2 { from { width: 0; } to { width: 100%; } }
        </css-doodle>
<css-doodle grid="16" id="fFloat">
        :doodle {
                @size: 1024px 600px;
                --state:paused;
        }
        position: absolute;
        left: @r(255)%;
        top: -10%;
        :after {
                position: absolute;
                content: '@p(你,♪,离不开,♫,♯,你,♮,♩,♬,☺,✲,❄)';
                color: snow;
                font-size: @r(6, 24)px;
        }
        animation: fall 40s @r(-6, 36)s infinite var(--state);
        @keyframes fall {
                from { transform: rotate(0deg) translate(0px); }
                to { transform: rotate(@r(-60,60)deg) translate(-1500px); }
        }
</css-doodle>
        <audio id="aud" src="https://pan.111t.net/view.php/b3417ec034be058552052f7259175744.mp3" autoplay loop></audio>
<div class="shou">
        <img src="" alt="" /></div>
</div>

<script>
(function() {
        let script = document.createElement('script');
        script.src = 'https://unpkg.com/css-doodle@0.34.9/css-doodle.min.js';
        document.head.appendChild(script);
        let slip = 0.1, mFlag = true, mKey = 0, clickIdx = 0, progChg = 0, cursors = ['default','pointer','pointer'];

let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
       
        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 ? ( papa.style.setProperty('--state', 'paused'),fFloat.style.setProperty('--state', 'paused') ) : ( papa.style.setProperty('--state','running'),fFloat.style.setProperty('--state', 'running'));
        let showLrc = (time) => {lrc.style.setProperty('--motion', mFlag ? 'cover1' : 'cover2');lrc.style.setProperty('--geci', '"' + lrcAr + '"');lrc.style.setProperty('--tt', time + 's');mKey += 1;mFlag = !mFlag;};
        aud.addEventListener('play', mState, false);
        aud.addEventListener('pause', mState, false);
        aud.addEventListener('seeked', () => calcKey());
        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('--ttmsg1', `'${toMin(aud.currentTime)}'`);mplayer.style.setProperty('--ttmsg2', `'${toMin(aud.duration)}'`);mplayer.style.setProperty('--prog',`${100 * aud.currentTime / aud.duration}%`);});
        mplayer.onclick = () => {if(clickIdx === 1) aud.paused ? aud.play() : aud.pause();if(clickIdx === 2) aud.currentTime = progChg;};
        mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();
})();
</script>

梦缘 发表于 2023-5-22 17:10

欣赏老师的精彩,真棒,问好!{:4_176:}

红影 发表于 2023-5-22 17:51

焱鑫磊的制作好漂亮。点赞{:4_187:}

红影 发表于 2023-5-22 17:52

我那路径设计的有点问题的,好像转回来的时候有点抖动{:4_173:}

焱鑫磊 发表于 2023-5-22 18:37

梦缘 发表于 2023-5-22 17:10
欣赏老师的精彩,真棒,问好!

问候梦缘好!{:4_187:}

焱鑫磊 发表于 2023-5-22 18:38

红影 发表于 2023-5-22 17:51
焱鑫磊的制作好漂亮。点赞

学生的模仿能力还行吧?{:4_170:}

焱鑫磊 发表于 2023-5-22 18:40

红影 发表于 2023-5-22 17:52
我那路径设计的有点问题的,好像转回来的时候有点抖动

内行看门道,外行看热闹。我看好得很呢。{:4_199:}

红影 发表于 2023-5-22 19:51

焱鑫磊 发表于 2023-5-22 18:38
学生的模仿能力还行吧?

学生这个称呼也适合我呢,我也跟在后面学的。这个按钮用这里正好呢,挺好看的{:4_187:}

红影 发表于 2023-5-22 19:52

焱鑫磊 发表于 2023-5-22 18:40
内行看门道,外行看热闹。我看好得很呢。

我也外行,只会乱弄{:4_173:}
页: [1]
查看完整版本: 《离不开你》黄绮珊(改编)