|
帖子代码
<style>
#papa { margin: 0 0 0 calc(50% - 593px); position: relative; width: 1024px; height: 640px; background: lightblue url('https://638183.freep.cn/638183/t24/jpg/21u.jpeg') no-repeat center/cover; box-shadow: 2px 4px 8px black; border: 8px ridge lightgreen; overflow: hidden; }
#vid { position: absolute; top: -70px; width: 100%; height: calc(100% + 70px); object-fit: cover; mix-blend-mode: screen; transform: scale(-1,1); }
#player { position: absolute; left: 160px; top: 100px; width: 200px; height: 200px; border-radius: 50%; filter: drop-shadow(3px 3px 8px darkgreen); cursor: pointer; transform: scale(var(--size)) rotate(0); animation: rotating 8s linear infinite var(--state); --size: 1.2; }
#player::before { position: absolute; content: ''; inset: 22px; border-radius: 50%; background: radial-gradient(yellow, transparent); box-shadow: 0 0 2px red, inset 0 0 160px lightblue; }
ye-zi { position: absolute; transform: rotate(60deg); offset-path: path('M0 100 A100 100 0 1 1 200 100 A100 100 0 1 1 0 100'); offset-distance: 50%; }
ye-zi::before, ye-zi::after { position: absolute; content: ''; width: 10px; height: 50px; border-radius: 10% 70%; background: linear-gradient(lightgreen, green, lightgreen); transform-origin: 50% 100%; }
ye-zi::after { transform: rotate(45deg); }
@keyframes rotating { to { transform: scale(var(--size)) rotate(-360deg); } }
</style>
<div id="papa">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=340858" autoplay loop></audio>
<video id="vid" src="https://img.tukuppt.com/video_show/2405811/00/01/79/5b4a079dd190a.mp4" loop muted></video>
<div id="player"></div>
</div>
<script>
var all = 12;
Array.from({length: all}).forEach((item,key) => {
item = document.createElement('ye-zi');
item.style.cssText += `offset-distance: ${100 * key / all}%;`;
player.prepend(item);
});
var mState = () => aud.paused ? (papa.style.setProperty('--state','paused'), vid.pause()) : (papa.style.setProperty('--state','running'), vid.play());
aud.addEventListener('playing', mState);
aud.addEventListener('pause', mState);
player.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>
|