|
|

楼主 |
发表于 2022-6-2 07:49
|
显示全部楼层
- <style>
- .outer { margin: auto; width: 760px; height: 560px; display: flex; justify-content: center; align-items: center; background: #ccc; position: relative; }
- .stage { width: 200px; height: 200px; display: flex; justify-content: center; align-items: center; cursor: pointer; position: absolute; }
- .stage meter { width: 200px; transform: rotate(-90deg); }
- .ball { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(120deg, #778899,#ffcc00); display: flex; justify-content: center; align-items: center; z-index: 99; }
- .ball::before{ position: absolute; content: ''; width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(120deg,olive,tan); animation: sway 6s linear infinite; }
- @keyframes sway { from { transform: rotate(0turn) translateY(-40px); } to { transform: rotate(1turn) translateY(-40px); } }
- </style>
- <div class="outer">
- <div class="stage">
- <div class="ball"></div>
- <meter id="meter" min="0" max="100" low="33" high="66" optimum="80" value="1"></meter>
- </div>
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=407677562.mp3" autoplay="autoplay" loop="loop"></audio>
- </div>
- <script>
- let stage = document.querySelector('.stage'),
- meter = document.querySelector('#meter'),
- ball = document.querySelector('.ball'),
- aud = document.querySelector('#aud');
- aud.addEventListener('timeupdate',function(){
- let prog = 100 * aud.currentTime / aud.duration;
- let deg = prog * 360 / 100;
- ball.style.transform = 'rotate(' + deg + 'deg) translateY(-' + prog + 'px)';
- meter.value = prog;
- });
- stage.onclick = () => aud.paused ? aud.play() : aud.pause();
- </script>
复制代码
|
评分
-
| 参与人数 1 | 威望 +30 |
金钱 +60 |
经验 +30 |
收起
理由
|
加林森
| + 30 |
+ 60 |
+ 30 |
很给力! |
查看全部评分
|