|
|

楼主 |
发表于 2023-12-13 12:15
|
显示全部楼层
【附】帖子代码
- <style>
- #papa { margin: 0 0 0 calc(50% - 593px); width: 1024px; height: 640px; background: #666 url('https://638183.freep.cn/638183/t23/webp2/jkufruqb.webp') no-repeat center/cover; overflow: hidden; display: grid; place-items: center; box-shadow: 3px 6px 12px gray; position: relative; z-index: 1; --state: paused; }
- #player { width: 300px; height: 300px; cursor: pointer; background: url('https://638183.freep.cn/638183/web/svg/3bb.svg') no-repeat center/cover; filter: brightness(200%) opacity(.6); animation: rotating 18s linear infinite var(--state); position: relative; }
- #player::before, #player::after { position: absolute; content: ''; width: 100%; height: 100%; background: inherit; transform: rotate(135deg); filter: invert(80%) opacity(.7); }
- #player::after { transform: rotate(60deg); filter: invert(100%) opacity(.5); }
- li-zi { position: absolute; width: 60px; height: 8px; border-radius: 100% 20%; background: tan; animation: imov 6s infinite; }
- @keyframes moving {
- from { opacity: 1; transform: translate(var(--x0),var(--y0)) rotate(var(--deg)); }
- to { opacity: 0; transform: translate(0,0) rotate(var(--deg)); }
- }
- @keyframes rotating { to { transform: rotate(360deg); } }
- </style>
- <div id="papa">
- <div id="player" title="播放/暂停"></div>
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1810150717" autoplay loop></audio>
- </div>
- <script>
- (function() {
- let all = 160;
- for(let i = 0; i < all; i++) {
- let movBall = document.createElement('li-zi');
- let hudu = Math.PI / 180 * 360 / all * i;
- let xx = 600 * Math.cos(hudu), yy = 600 * Math.sin(hudu);
- movBall.style.cssText += `
- --x0: ${xx}px;
- --y0: ${yy}px;
- --deg: ${360 / all * i}deg;
- background: #${Math.random().toString(16).substr(-6)};
- animation: moving ${Math.random() * 20 + 20}s -${Math.random() * 20}s infinite var(--state);
- `;
- papa.prepend(movBall);
- }
- let playMusic = () => aud.paused ? (aud.play(), player.title='暂停') : (aud.pause(), player.title='播放');
- let mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
- aud.addEventListener('playing',mState,false);
- aud.addEventListener('pause',mState,false);
- player.addEventListener('click',playMusic,false);
- })();
- </script>
复制代码
|
评分
-
| 参与人数 2 | 威望 +45 |
金钱 +90 |
经验 +45 |
收起
理由
|
雨声
| + 15 |
+ 30 |
+ 15 |
赞一个! |
冬天的雨
| + 30 |
+ 60 |
+ 30 |
赞一个! |
查看全部评分
|