加林森 发表于 2022-3-21 12:15

本帖最后由 加林森 于 2022-6-2 10:14 编辑 <br /><br />红影 发表于 2022-3-21 12:00
边回帖就边能帖子里看到当前时间,有意思。
就是,很方便的。

<style>

.outer { left: -342px; width: 1280px; height: 720px; display: flex; justify-content: center; align-items: center; background: tan url('https://pic.imgdb.cn/item/629818c00947543129a766c6.jpg') no-repeat; position: relative; }
.stage { width: 200px; height: 200px; display: flex; justify-content: center; align-items: center; cursor: pointer; position: absolute; }
.stage meter { width: 200px; }
.ball { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(120deg, #789262,#e4c6d0); z-index: 99; }
.ball::before{ position: absolute; content: ''; width: 10px; height: 10px; top: calc(50% - 5px); left: calc(50% - 5px); 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=18861466.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>

红影 发表于 2022-3-21 12:28

加林森 发表于 2022-3-21 12:15
就是,很方便的。

也非常有趣。

加林森 发表于 2022-3-21 12:41

红影 发表于 2022-3-21 12:28
也非常有趣。

是的,好玩我们就多玩几次,这样就更加能够记得牢了。

红影 发表于 2022-3-21 18:36

加林森 发表于 2022-3-21 12:41
是的,好玩我们就多玩几次,这样就更加能够记得牢了。

嗯嗯,这个也是可行的。

加林森 发表于 2022-3-21 19:31

红影 发表于 2022-3-21 18:36
嗯嗯,这个也是可行的。

就是啊。
页: 1 [2]
查看完整版本: 【与我无关】-阿冗