本帖最后由 花简静 于 2024-8-18 15:43 编辑
<style>
#mydiv {
margin: 130px 0 30px calc(50% - 931px);
width: 1700px;
height:900px;
background: url('https://pic.imgdb.cn/item/66ae2051d9c307b7e9ddd76d.jpg') no-repeat center/cover;
display: grid;
place-items: center;
pointer-events: none;
box-shadow: 0 0 6px rgba(0,0,0,.6);
z-index: 1;
position: relative;
overflow: hidden;
--conic: 2%;
}
#mydiv::before {
position: absolute;
content: '';
top: 0px;
width: 1700px;
height:900px;
background: url('https://pic.imgdb.cn/item/66ae12fed9c307b7e9c98879.png') no-repeat center/cover;
z-index: 5;
}
#mydiv::after {
position: absolute;
content: '';
left:160px;
bottom: 300px;
width: 120px;
height: 120px;
background: repeating-conic-gradient(transparent, CadetBlue, transparent 6% var(--conic));
-webkit-mask: url('https://638183.freep.cn/638183/small/7s.png') no-repeat center/cover;
pointer-events: auto;
cursor: pointer;
animation: rot 8s linear infinite var(--state);
transform: rotate(var(--deg));
z-index: 4;
}
#mydiv:hover::after { --conic: 6%; filter: hue-rotate(210deg);}
#vid1 {
top:-80px;
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
-webkit-mask: linear-gradient(to top, transparent, red);
z-index: 2;
}
#vid2 {
bottom:-100px;
position: absolute;
width: 100%;
height: 80%;
opacity: .80;
object-fit: cover;
mix-blend-mode: multiply;
-webkit-mask: linear-gradient(to bottom,transparent,transparent, red);
z-index: 3;
}
@keyframes rot {
to { transform: rotate(1turn); }
}
</style>
<div id="mydiv">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1485774690" autoplay loop></audio>
<video id="vid1" src="https://img.tukuppt.com/video_show/2418175/00/01/72/5b49440ab4e45.mp4" autoplay loop muted></video>
<video id="vid2" src="https://img.tukuppt.com/video_show/2475824/00/01/72/5b492fae7af99.mp4" autoplay loop muted></video>
</div>
<script>
aud.oncanplay = aud.onplaying = aud.onpause = () => {
mydiv.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.paused ? (vid1.pause(), vid2.pause()): (vid1.play(), vid2.play());
};
mydiv.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>
|