本帖最后由 花简静 于 2024-12-22 22:00 编辑
<style>
#dbox {
margin:130px 0 30px calc(50% - 931px);
width: 1700px;
height: 900px;
background: url('https://642303.freep.cn/642303/tu/20241009hkbaqs.webp') 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: 480px; bottom:340px; }
#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(210,105,30,.1); } }
</style>
<div id="dbox">
<video id="vid" src="https://img.tukuppt.com/video_show/15653652/00/79/86/60c98c8146068.mp4" autoplay loop muted></video>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1461351717" 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>
|