朵拉 发表于 2024-10-3 17:20

蝴 蝶(马黑黑原创)

<style>
        #dbox { margin: 30px 0 30px calc(50% - 593px); width: 1024px; height: 640px; background: radial-gradient(transparent 70%,transparent,rgba(0,0,128,.6)), url('https://pic.imgdb.cn/item/66fe557e335a200d6a7bdb9b.jpg') no-repeat center/cover; box-shadow: 4px 4px 16px #00000080; z-index: 1; position: relative; }
        #msvg { position: absolute; right: 50px; bottom: 120px; }
        #cpath { cursor: pointer; filter: drop-shadow(0 0 4px #000); transform-origin: 50%; animation: rot 6s linear infinite var(--state), chgcolor 12s linear infinite alternate var(--state); }
        #vid { position: absolute; width: 100%; height: 100%; object-fit: cover; -webkit-mask: radial-gradient(green, transparent, transparent); }
        @keyframes rot { to { transform: rotate(360deg); stroke-dashoffset: -160; } }
        @keyframes chgcolor { to { fill: rgba(65,105,225,.5); } }

</style>

<div id="dbox">
        <audio id="aud" src="https://www.kumeiwp.com/wj/194449/2024/01/16/9fe4e129bdb874eb75a62517e40ac564.mp3" autoplay="" loop=""></audio>
       
        <video id="vid" src="https://img.tukuppt.com/video_show/2269348/00/17/44/5ec493e202caa.mp4" autoplay loop muted></video>
        <svg id="msvg" width="200" height="200">
                <defs>
                        <g id="cpath"fill="rgba(65,105,225,.1)" stroke="rgba(255,255,255,.7)" stroke-width="4" stroke-dasharray="4">
                                <path d='M100 120 C10 -30,190 -30,100 120'/>
                        </g>
                </defs>
        </svg>
</div>

<script>
        mState = () => {
                dbox.style.setProperty('--state', aud.paused ? 'paused' : 'running');
                aud.paused ? (msvg.pauseAnimations(), vid.pause()) : (msvg.unpauseAnimations(), vid.play());
        }
        mkLeaves = (total) => {
                let str = '';
                Array(total).fill().forEach((_,idx) => {
                        str += `<use href="#cpath" transform="rotate(${360 / total * idx} 100 100)"/>`;
                });
                return str;
        };
        msvg.innerHTML += mkLeaves(5);
        aud.onplaying = aud.onpause = () => mState();
        msvg.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>

朵拉 发表于 2024-10-3 17:20

@马黑黑
老师好 学生交作业,请指正哈{:4_190:}

愤怒的葡萄 发表于 2024-10-3 17:50

不错,不错。

梦江南 发表于 2024-10-3 17:59

很漂亮!{:4_199:}

红影 发表于 2024-10-3 19:14

视频选得好,和背景的蝴蝶相呼应呢。如果也是蓝蝶就更好了{:4_173:}
欣赏朵宝好帖{:4_187:}

小辣椒 发表于 2024-10-3 20:10

欣赏朵拉精彩的制作{:4_199:}

绿叶清舟 发表于 2024-10-3 21:02

制作漂亮,朵拉作业完成得好快啊
页: [1]
查看完整版本: 蝴 蝶(马黑黑原创)