|
|

楼主 |
发表于 2023-2-28 21:38
|
显示全部楼层
代码
- <style>
- #mplayer {
- --state: running;
- margin: 50px auto;
- width: 120px;
- height: 120px;
- position: relative;
- display: grid;
- place-items: center;
- }
- .ball {
- position: absolute;
- width: 15px;
- height: 15px;
- border-radius: 50%;
- box-shadow: -5px 0 10px black inset;
- }
- @keyframes flash { to { box-shadow: 0 0 60px 20px gray, -2px -2px 8px snow inset; } }
- </style>
- <div id="mplayer"></div>
- <script>
- let total = 18;
- for(let i = 0; i < total; i ++) {
- let ball = document.createElement('span');
- ball.className = 'ball';
- ball.style.cssText += `
- transform: rotate(${360/total*i}deg) translate(60px);
- animation: flash ${Math.random()+0.1}s infinite alternate var(--state);
- `;
- mplayer.appendChild(ball);
- }
- </script>
复制代码
|
|