2024年6月16日 星期日
<style>
#papa { margin: 30px 0 30px calc(50% - 602px); width: 1024px; height: 640px; background: url('https://638183.freep.cn/638183/t24/3/hduf.jpg') no-repeat 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: 100px; height: 100px; 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: 544px; }
#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: rotate(360deg); } }
</style>
<div id="papa">
<img id="mypic" src="https://638183.freep.cn/638183/t23/btn/dou.png" 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>
|