朵拉 发表于 2024-2-14 20:50

钵钵鸡(马黑黑原创)

本帖最后由 朵拉 于 2024-2-14 20:57 编辑 <br /><br /><style>
#papa {
      margin: 0 0 0 calc(50% - 593px);
      width: 1024px;
      height: 640px;
      background: url('https://pic.imgdb.cn/item/65ccb84e9f345e8d031a4d65.jpg') no-repeat center/cover;
      box-shadow: 3px 3px 20px #000;
      position: relative;
      z-index: 1;
}
#mplayer {
      position: absolute;
      top: 20px;
      left: calc(50% - 80px);
      width: 160px;
      height: 160px;
      border-style: dotted double ridge;
      border-color: olive green lightgreen;
      border-width: 10px 20px;
      border-radius: 50%;
      background: url('https://pic.imgdb.cn/item/65ccb84e9f345e8d031a4d65.jpg') no-repeat center/cover;
      animation: borderSize .3s linear infinite alternate var(--state);
      cursor: pointer;
}
@keyframes borderSize {
      from { border-width: 10px 20px; }
      to { border-width: 20px 10px; }
}
</style>

<div id="papa">
      <audio id="aud" src="https://music.163.com/song/media/outer/url?id=2123292201" autoplay loop></audio>
      <div id="mplayer"></div>
</div>

<script>
var mState = () => mplayer.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('pause', mState);
aud.addEventListener('playing',mState);
mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>

朵拉 发表于 2024-2-14 20:58

@马黑黑
马师 大年初五快乐,
学生交作业,请指正哈~~{:4_190:}

马黑黑 发表于 2024-2-14 21:33

钵钵鸡好吃

红影 发表于 2024-2-14 21:57

这个有意思。欣赏朵宝好帖{:4_187:}
页: [1]
查看完整版本: 钵钵鸡(马黑黑原创)