红影 发表于 2023-5-21 21:54

《风筝误》(学习黑黑路径设计)


<style>
#papa {margin: 80px 0 0 calc(50% - 593px);width: 1024px;height: 600px;background: tan url('https://pic1.imgdb.cn/item/646a14ebe03e90d874abdb0f.jpg');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://music.163.com/song/media/outer/url?id=1458314053.mp3" autoplay loop></audio>
<div class="shou">
        <img src="https://pic1.imgdb.cn/item/646a1681e03e90d874adc02e.png" 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-21 21:56

也跟着学个路径设计,同时复习一下手臂的摇动。为了抠图折腾半天,而且那根线扣不出,只能自己画个线,画得不好,像树枝了{:4_189:}

红影 发表于 2023-5-21 21:57

暂停其他的都能挺,摇动的手臂挺不下,不能再折腾了,耽误太多回帖时间了{:4_173:}

大山 发表于 2023-5-21 22:42

风筝误 悟了一句情似露珠
谁约我 又在这 风烟处
风筝误

红影 发表于 2023-5-21 23:12

大山 发表于 2023-5-21 22:42
风筝误 悟了一句情似露珠
谁约我 又在这 风烟处
风筝误

这首歌我也不熟,为了做帖子去找的{:4_173:}

醉美水芙蓉 发表于 2023-5-22 06:35

焱鑫磊 发表于 2023-5-22 09:11

红影棒棒哒{:4_204:}

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

美女放风筝好看,歌好听,欣赏点赞!{:4_204:}

罗浮梦 发表于 2023-5-22 11:37

这也太美了吧{:4_199:}

罗浮梦 发表于 2023-5-22 11:37

图有特效相得益彰,漂亮。

马黑黑 发表于 2023-5-22 11:49

红影 发表于 2023-5-21 21:56
也跟着学个路径设计,同时复习一下手臂的摇动。为了抠图折腾半天,而且那根线扣不出,只能自己画个线,画得 ...

这是指挥棒,指哪儿风筝飞哪儿的意思{:4_170:}

南无月 发表于 2023-5-22 18:00

这个是真正的路径作业,有自己的创新,点个大大的赞{:4_199:}

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

醉美水芙蓉 发表于 2023-5-22 06:35
无线遥控风筝漂亮!

谢谢水芙蓉,我发现线还是很难抠图的,自己画又画不好{:4_173:}

红影 发表于 2023-5-22 18:53

焱鑫磊 发表于 2023-5-22 09:11
红影棒棒哒

谢谢焱鑫磊鼓励,看到你也做出来了,好棒的{:4_187:}

红影 发表于 2023-5-22 18:54

梦缘 发表于 2023-5-22 10:54
美女放风筝好看,歌好听,欣赏点赞!

抱抱梦缘,感谢鼓励。那个美女是找的图片,胳膊的动态是我学做的{:4_173:}

红影 发表于 2023-5-22 18:56

罗浮梦 发表于 2023-5-22 11:37
这也太美了吧

谢谢梦儿,我是跟在后面学代码呢,自己瞎折腾{:4_173:}

红影 发表于 2023-5-22 18:57

罗浮梦 发表于 2023-5-22 11:37
图有特效相得益彰,漂亮。

就弄了手臂的挥动,不细看都看不出来啊{:4_170:}

红影 发表于 2023-5-22 18:58

马黑黑 发表于 2023-5-22 11:49
这是指挥棒,指哪儿风筝飞哪儿的意思

那根线给我画成了树枝了,哈哈。
对了,正想问问黑黑,我的那个线路为什么转动时候有个抖动一下的感觉啊{:4_203:}

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

南无月 发表于 2023-5-22 18:00
这个是真正的路径作业,有自己的创新,点个大大的赞

我试着自己设计个线路,也不行,很难模仿出风筝的飞行样子呢。
是跑去那个网站,看到这个按钮像风筝,才想着要设计个线路的{:4_173:}

马黑黑 发表于 2023-5-22 20:24

红影 发表于 2023-5-22 18:58
那根线给我画成了树枝了,哈哈。
对了,正想问问黑黑,我的那个线路为什么转动时候有个抖动一下的感觉啊 ...

你显卡不好
页: [1] 2 3 4
查看完整版本: 《风筝误》(学习黑黑路径设计)