海神
本帖最后由 福宝 于 2024-6-28 11:14 编辑 <br /><br /><style>#papa { margin: 30px 0 30px calc(50% - 781px); width: 1400px; height: 800px; background: url('https://gd-hbimg.huaban.com/f3091dbe5dc1ec89956b2469487b92fcf9f8c31f74063-BYlw9s_fw1200') no-repeattop -400px center/cover; box-shadow: 3px 3px 20px #000; overflow: hidden; position: relative; user-select: none; z-index: 1; }
#papa::before, #papa::after { content: ''; position: absolute; width: 120px; height: 120px; background: white; clip-path: polygon(0 0, 0 100%, 100% 100%, 0 0); opacity: .7; }
#papa::before { left: 0; bottom: 0; transition: 2s; }
#papa::after { right: 0; transform: scale(-1, -1); }
#papa:hover::before { bottom: 800px; }
#mypic { position: absolute; width: 200px; right: 5px; top: 5px; cursor: pointer; z-index: 6; animation: rot 6s infinite linear var(--state); }
#vid { position: absolute; bottom: 0; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; pointer-events: none; opacity: .6; }
@keyframes rot { to { transform: rotateY(360deg); } }
</style>
<div id="papa">
<img id="mypic" src="https://gd-hbimg.huaban.com/3cc06e94e5d0d0143a6b89ee7aa9edba1f7e69592c5cf-7NBLiu" alt="" title="播放/暂停" />
<video id="vid" src="https://img.tukuppt.com/video_show/2405811/00/01/97/5b4eac286249a.mp4" autoplay loop muted disablePictureInPicture></video>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=817876" autoplay loop></audio>
</div>
<script>
let mState = () => {
papa.style.setProperty('--state', ['running','paused'][+aud.paused]);
aud.paused ? vid.pause() : vid.play();
}
aud.addEventListener('pause', () => mState());
aud.addEventListener('playing', () => mState());
mypic.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>
这海神有点凶
页:
[1]