|
|

楼主 |
发表于 2024-2-12 17:04
|
显示全部楼层
帖子代码
- <style>
- #papa {
- margin: 0 0 0 calc(50% - 593px);
- width: 1024px;
- height: 640px;
- background: url('https://638183.freep.cn/638183/t24/jpg/23u.jpeg') no-repeat center/cover;
- box-shadow: 3px 3px 20px #000;
- position: relative;
- z-index: 1;
- }
- #mplayer {
- position: absolute;
- top: 20px;
- left: calc(50% - 80px);
- width: 160px;
- height: 160px;
- border-style: dotted double ridge;
- border-color: olive green lightgreen;
- border-width: 10px 20px;
- border-radius: 50%;
- background: url('https://638183.freep.cn/638183/t24/jpg/23u.jpeg') no-repeat center/cover;
- animation: borderSize .3s linear infinite alternate var(--state);
- cursor: pointer;
- }
- @keyframes borderSize {
- from { border-width: 10px 20px; }
- to { border-width: 20px 10px; }
- }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1419317515" autoplay loop></audio>
- <div id="mplayer"></div>
- </div>
- <script>
- var mState = () => mplayer.style.setProperty('--state', aud.paused ? 'paused' : 'running');
- aud.addEventListener('pause', mState);
- aud.addEventListener('playing',mState);
- mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();
- </script>
复制代码
|
|