加林森 发表于 2022-3-21 13:51

本帖最后由 加林森 于 2022-5-21 13:05 编辑 <br /><br />马黑黑 发表于 2022-3-21 13:49
这个帖子很别致
是的,我想了许久,又调整了几次才制作出来的。


<style>
.wrap {
      left: -20px;
      width: 800px; height: 463px;
      background: teal url('https://pic.imgdb.cn/item/628852a90947543129d5180b.jpg') no-repeat center/cover;
      position: relative;
}
.circle {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 80px; height: 80px;
      left: 10px; bottom: 10px;
      border: solid 6px transparent;
      border-radius: 50%;
      background-image: radial-gradient(ghostwhite, transparent), linear-gradient(120deg,tomato,green,red,gold);
      background-origin: border-box;
      background-clip: content-box, border-box;
      cursor: pointer;
      font: normal 14px sans-serif;
      position: absolute;
}
.circle::before { position: absolute; content: attr(data-per); bottom: 20%;}
.circle::after { position: absolute; content: ''; width: 10px; height: 10px; background: olive; border-radius: 50%; }
.hand {
      position: absolute; width: 2px; height: 50%;
      bottom: 50%; background: rgba(200,20,20,.45);
      transform-origin: bottom;
}
.wrap::before {
      content: '';
      position: absolute;
      width: 50%;
      height: 50%;
      background: url('https://pic.imgdb.cn/item/6235d74f5baa1a80ab9d74a0.gif') no-repeat

center/cover;
      opacity: .55;
      left:30px; top: 20px;
}
</style>

<div class="wrap">
      <div class="circle" data-per="0%">
                <div class="hand"></div>
      </div>
</div>
<audio id="aud" src="https://www.joy127.com/url/928.mp3" autoplay="autoplay" loop="loop"></audio>

<script>
let circle = document.querySelector('.circle');
let hand = document.querySelector('.hand');
let aud = document.querySelector('#aud');
let current, task;

aud.addEventListener('timeupdate', function(){
      task = aud.duration;
      current = aud.currentTime;
      setProgress(task,current);
});

circle.onclick = () =>{ aud.paused ? aud.play() : aud.pause(); };

function setProgress(tt,cc) {
      if(tt <= 0 || cc <= 0) return false;
      let prog = 100 * cc / tt;
      hand.style.transform = `rotate(${360*prog/100}deg`;
      circle.setAttribute('data-per', prog.toFixed(2) + '%');
}
</script>

马黑黑 发表于 2022-3-21 13:52

加林森 发表于 2022-3-21 13:51
是的,我想了许久,又调整了几次才制作出来的。

大胆去做

加林森 发表于 2022-3-21 13:53

马黑黑 发表于 2022-3-21 13:52
大胆去做

好的好的,以后我会去找另外的动态图片,再来制作。

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

加林森 发表于 2022-3-21 12:42
好的。

队长晚上好{:4_187:}

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

红影 发表于 2022-3-21 18:29
队长晚上好

红影晚上好!{:4_204:}{:4_190:}

马黑黑 发表于 2022-3-21 19:56

加林森 发表于 2022-3-21 13:53
好的好的,以后我会去找另外的动态图片,再来制作。

期待

加林森 发表于 2022-3-21 20:51

马黑黑 发表于 2022-3-21 19:56
期待

嗯嗯
页: 1 [2]
查看完整版本: 《我要回来》-- 吉克永都