帖子代码
<style>
#tiezi {
--width: 960px;
margin: 130px 0 30px calc(50% - (var(--width) / 2 + 81px));
width: var(--width);
height: 600px;
background:
url('https://638183.freep.cn/638183/t24/3/mzuj.jpg') no-repeat center/cover,
radial-gradient(transparent 25%, orange 30%, transparent 35%) center/30% 30%,
radial-gradient(circle, transparent 25%, green 26%, green 28%, transparent 29%) center/30% 10%;
background-blend-mode: overlay, color, difference;
box-shadow: 0 0 10px rgba(0,0,0,.5);
pointer-events: none;
position: relative;
}
#tiezi::before, #tiezi::after {
position: absolute;
content: '';
}
#tiezi::before {
inset: 0;
background: linear-gradient(to right, transparent, rgba(0,0,0,.3), transparent, rgba(0,0,0,.3), transparent) 0 0/200% 100%;
animation: bgmove 4s infinite alternate var(--state);
}
#tiezi::after {
left: 280px;
top: 10px;
content: url('https://638183.freep.cn/638183/t22/btn/star.png');
cursor: pointer;
pointer-events: auto;
opacity: .8;
transform: rotate(15deg);
animation: flash 1s infinite alternate var(--state);
}
@keyframes bgmove { to { background-position: -200% 0; } }
@keyframes flash { to { transform: rotate(-15deg); opacity: .1; } }
</style>
<div id="tiezi">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=411356357" poster="https://638183.freep.cn/638183/t23/btn/f3.png" autoplay loop></audio>
</div>
<script>
aud.oncanplay = aud.onplaying = aud.onpause = () => tiezi.style.setProperty('--state', ['running','paused'][+aud.paused]);
tiezi.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>
|