子楹。 发表于 2025-10-29 20:07

试贴

本帖最后由 子楹。 于 2025-10-31 19:21 编辑 <br /><br /><style>
        #dbox {
        margin: 130px 0 30px calc(50% - 931px);
        width: 1600px;
        height: 950px;
        background: url('https://image.hnol.net/c/2025-10/31/19/202510311915522971-5027609.jpg') no-repeat center/cover;
        border-radius: 6px;
        box-shadow: 3px 3px 8px gray;
        position: relative;
        overflow: hidden;
}
        #vid {
                position: absolute;
                width: 110%;
                height: 110%;
                object-fit: cover;
                left:-6%;
                top:-4%;
                mix-blend-mode:screen;
                pointer-events: none;
                opacity: 0.79;
                -webkit-mask: linear-gradient(to bottom,transparent,red,red);
}
        #msvg { position: absolute; right: 410px; bottom:550px; }
        #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); }
        @keyframes rot { to { transform: rotate(360deg); stroke-dashoffset: -160; } }
        @keyframes chgcolor { to { fill: rgba(100,55,30,.1); } }
</style>

<div id="dbox">
<video id="vid" src="https://img.tukuppt.com/video_show/2269348/00/14/92/5e67af3447155.mp4" autoplay loop muted></video>
        <audio id="aud" src="https://music.163.com/song/media/outer/url?id=2135442273" autoplay loop></audio>
       
        <svg id="msvg" width="200" height="200">
                <defs>
                        <g id="cpath"fill="rgba(210,105,30,.15)" stroke="rgba(255,255,255,.8)" 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>
页: [1]
查看完整版本: 试贴