帖子代码
<style>
#papa {
margin: 30px 0 30px calc(50% - 593px);
width: 1024px;
height: 600px;
background: url('https://638183.freep.cn/638183/t24/2/moma.jpg') no-repeat center/cover;
overflow: hidden;
box-shadow: 0 0 10px rgba(0,0,0,.5);
z-index: 1;
position: relative;
}
#player {
position: absolute;
bottom: -60px;
left: calc(50% - 265px);
width: 300px;
height: 300px;
border: 6px solid orange;
border-radius: 50%;
cursor: pointer;
transform: rotateX(60deg);
--tt: 6s;
}
#player::before, #player::after {
position: absolute;
content: '';
border: inherit;
border-radius: inherit;
animation: rot var(--tt) linear infinite var(--state);
}
#player::before {
inset: 20px;
border-color: transparent gold;
}
#player::after {
inset: 40px;
border-width: 12px;
border-style: dashed;
--tt: 4s;
}
li-zi {
position: absolute;
width: 10px;
height: 20px;
border-radius: 50%;
box-shadow: inset 0 0 10px red;
}
@keyframes moving {
from { transform: translateY(0); opacity: 1; }
to { transform: translateY(-800px); opacity: 0; }
}
@keyframes rot { to { transform: rotate(360deg); } }
</style>
<div id="papa">
<!-- Moola Mantra -->
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=19277603" autoplay loop></audio>
<div id="player" title="播放/暂停" class="loading"></div>
</div>
<script>
var all = 100;
for(var i = 0; i < all; i++) {
var lz = document.createElement('li-zi');
lz.style.cssText += `
left: ${ 60 + Math.floor(Math.random() * 160)}px;
top: ${ 60 + Math.floor(Math.random() * 160)}px;
background: #${Math.random().toString(16).substring(2,8)};
animation: moving ${Math.random() * 2 + 2}s -${Math.random() * 4}s cubic-bezier(0.01, 0.12, 0.6, 1.04) infinite var(--state);
`;
player.prepend(lz);
}
aud.oncanplay = aud.onplaying = aud.onpause = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
player.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>
|