|
|

楼主 |
发表于 2024-1-6 20:43
|
显示全部楼层
帖子代码(很简单):
- <style>
- #papa { margin: 0 0 0 calc(50% - 652px); width: 1300px; height: 820px; background: lightblue url('https://638183.freep.cn/638183/t24/jpg/despacito.jpg'); box-shadow: 3px 3px 20px #000; position: relative; overflow: hidden; z-index: 1; }
- #myplayer { position: absolute; left: calc(50% - 120px); top: 10px; transition: filter 1s; cursor: pointer; animation: rotating 5s infinite linear var(--state); }
- #myplayer:hover { filter: hue-rotate(360deg); }
- #vid { position: absolute; top: -70px; width: 1300px; height: 880px; object-fit: cover; mix-blend-mode: screen; }
- @keyframes rotating { to { transform: rotate(360deg); } }
- </style>
- <div id="papa">
- <video id="vid" src="https://img.tukuppt.com/video_show/2269348/00/02/01/5b4ef06f1969e.mp4" muted loop autoplay></video>
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=500374416" autoplay loop></audio>
- <img id="myplayer" src="https://638183.freep.cn/638183/t23/btn/snow.webp" alt="" title="play&pause" />
- </div>
- <script>
- aud.addEventListener('playing', mState, false);
- aud.addEventListener('pause', mState, false);
- myplayer.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
- function mState() {
- aud.paused
- ? (papa.style.setProperty('--state', 'paused'), vid.pause(), myplayer.title = '播放')
- : (papa.style.setProperty('--state','running'), vid.play(), myplayer.title = '暂停');
- }
- </script>
复制代码
|
评分
-
| 参与人数 1 | 威望 +50 |
金钱 +100 |
经验 +50 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|