|
|

楼主 |
发表于 2022-6-2 21:46
|
显示全部楼层
- <style>
- .outer { left: -70px; width: 900px; height: 600px; box-shadow: 2px 2px 4px #333; background: teal url('https://www.huachaowang.com/data/attachment/forum/202206/02/122851uis56rkypcsi5sxs.jpg') no-repeat; position: relative; }
- .ele1 { position: absolute; left: 400px; top: 240px; width: 80px; height: 80px; border-radius: 50%;background: #ccc linear-gradient(transparent 49%,rgba(255,0,0,.65) 50%,transparent 0) no-repeat; background-size: 0% 100%; box-shadow: 5px 5px 30px 0 gray; cursor:pointer; }
- .ele1::before, .ele1::after { position: absolute; content: ''; width: inherit; height: inherit; border-radius: inherit; }
- .ele1::before { background: linear-gradient(transparent,rgba(0,0,0,0)); animation: flash 1s linear infinite; }
- .ele1::after { background: radial-gradient(circle at 30% 30%,transparent,rgba(0,255,0,.25)); }
- @keyframes flash { to { background: linear-gradient(transparent,rgba(0,0,0,.6)); } }
- </style>
- <div class="outer">
- <div class="ele1"></div>
- </div>
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=5276829.mp3" autoplay="autoplay" loop="loop"></audio>
- <script>
- let ele1 = document.querySelector('.ele1'), aud = document.querySelector('#aud');
- ele1.onclick = () => aud.paused ? aud.play() : aud.pause();
- aud.addEventListener('timeupdate',() => ele1.style.backgroundSize = 100 * aud.currentTime / aud.duration + '% 100%');
- </script>
复制代码
|
|