本帖最后由 凡哥 于 2024-9-26 15:39 编辑
测试 helight_01
帖子代码
<style>
#tz { margin: 30px 0 30px calc(50% - 730px); width: 1280px; height: 720px; background: url('https://638183.freep.cn/638183/t24/webp2/uuvi.webp') no-repeat 0 0 / 612px 408px, url('https://638183.freep.cn/638183/t24/4/gg.jpg') no-repeat center/cover; box-shadow: 0 0 4px #111; z-index: 1; animation: bgmove 3s linear infinite alternate var(--state); position: relative; }
#player { position: absolute; right: 10px; bottom: 10px; cursor: pointer; filter: drop-shadow(2px 1px 4px #000); }
@keyframes bgmove { to { background-position: -10px -5px, center }; }
</style>
<div id="tz">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=498210" autoplay loop></audio>
<svg id="player" width="400" height="40" viewBox="-50 -5 100 10" style="">
<g style="fill="none" stroke="green" stroke-width="10" stroke-dasharray="4" >
<line x1="-50" y1="0" x2="50" y2="0"></line>
<line x1="-50" y1="0" x2="50" y2="0" stroke="lightgreen">
<animate attributeName="stroke-dashoffset" values="0;2;0;-2;0" dur="1.5s" repeatCount="indefinite"></animate>
</line>
</g>
</svg>
</div>
<script>
mState = () => aud.paused ? (tz.style.setProperty('--state', 'paused'), player.pauseAnimations()) : (tz.style.setProperty('--state', 'running'), player.unpauseAnimations());
aud.onplaying = aud.onpause = () => mState();
player.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>
|