|
|

楼主 |
发表于 2024-7-9 12:12
|
显示全部楼层
帖子代码
- <style>
- #mydiv { --width: 1024px; margin: 30px 0 30px calc(50% - (var(--width) / 2 + 1px)); width: var(--width); height: 640px; border: 1px solid gray; background: linear-gradient(to top right, rgba(0,90,0,.1), rgba(0,90,0,.5), rgba(0,90,0,.1)) center/100%, linear-gradient(to top left, rgba(0,90,0,.1), rgba(0,90,0,.5), rgba(0,90,0,.1)) center/100%, repeating-radial-gradient(red, transparent, transparent) center/60% 80%, url('https://img.zcool.cn/community/01a2685d73390ca8012060befbe29c.jpg@3000w_1l_0o_100sh.jpg') no-repeat center/cover ; background-blend-mode: overlay; animation: bgmove 3s infinite alternate var(--state); z-index: 1; position: relative; }
- #player { position: absolute; left: calc(50% - 60px); top: 30px; width: 120px; filter: hue-rotate(175deg); transition: width 2s; opacity: .65; cursor: pointer; animation: rot 8s linear infinite var(--state); }
- #player:hover { width: 150px; }
- @keyframes bgmove { to { background-size: 100%,100%,100% 100%,cover; } }
- @keyframes rot { to {transform: rotate(360deg); } }
- </style>
- <div id="mydiv">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=5256016" autoplay loop></audio>
- <img id="player" alt="" src="https://638183.freep.cn/638183/t23/btn/hshx.png" />
- </div>
- <script>
- var sF = document.createElement('script');
- sF.src = 'https://638183.freep.cn/638183/web/api/fullscreen.js';
- sF.charset = 'utf-8';
- document.querySelector('body').appendChild(sF);
- sF.onload = () => FS({
- papa: '#mydiv',
- css: 'bottom: 20px; left: 50%; transform: translate(-50%); --color: lightblue; --fsBg: transparent;',
- });
- var mState = () => {
- mydiv.style.setProperty('--state',['running','paused'][+aud.paused]);
- player.title = ['暂停','播放'][+aud.paused];
- };
- aud.oncanplay = aud.onplaying = aud.onpause = () => mState();
- player.onclick = () => aud.paused ? aud.play() : aud.pause();
- </script>
复制代码
|
|