|
|

楼主 |
发表于 2023-2-8 12:12
|
显示全部楼层
帖子代码
- <style>
- #papa {
- --state: paused;
- left: calc(50% - 81px);
- transform: translateX(-50%);
- width: 1024px;
- height: 640px;
- background: teal url('https://638183.freep.cn/638183/t23/webp/lmhxii.webp') no-repeat center/cover;
- box-shadow: 8px 4px 18px hsla(0,0%,0%,.28);
- display: grid;
- place-items: center;
- position: relative;
- z-index: 1;
- }
- #papa::before, #papa::after {
- position: absolute;
- content: '';
- left: -8px;
- top: -8px;
- right: -8px;
- bottom: -8px;
- border: 8px solid green;
- border-radius: 6px;
- pointer-events: none;
- clip-path: inset(90% 0% 0% 0%);
- animation: clip 12s infinite linear;
- animation-play-state: var(--state);
- }
- #papa::after {
- animation-delay: -6s;
- }
- #mplayer {
- position: absolute;
- bottom: 30px;
- width: 200px;
- height: 200px;
- background: url('https://638183.freep.cn/638183/t23/1/lotus.png') no-repeat center/cover;
- border-radius: 50%;
- cursor: pointer;
- animation: spin 10s infinite linear;
- animation-play-state: var(--state);
- }
- @keyframes spin { to { transform: rotate(-1turn); } }
- @keyframes clip {
- 25% { clip-path: inset(0% 0% 0% 90%); border-color: green; }
- 50% { clip-path: inset(0% 0% 90% 0%); border-color: lightgreen; }
- 75% { clip-path: inset(0% 90% 0% 0%); border-color: orange; }
- 100% { clip-path: inset(90% 0% 0% 0%); border-color: darkgreen; }
- }
- </style>
- <div id="papa">
- <div id="mplayer"></div>
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=448520354.mp3" autoplay loop></audio>
- </div>
- <script>
- (function() {
- (function(mkFS) {let setFullScreen = (user_set) => {let pa = user_set.pa;if(typeof(pa) !== 'object') return false;if(!user_set.set) user_set.set = 'color: snow; background: black; border: 2px solid snow; left: 40px; bottom: 40px;';btnMsg = document.createElement('span');btnMsg.style.cssText = `position: absolute; border-radius: 8px; padding: 4px; cursor: pointer; z-index:998; ${user_set.set}`;btnMsg.innerText = '全屏观赏';btnMsg.style.display = 'none';pa.appendChild(btnMsg);let timerId, fs = false;btnMsg.onclick = () => fs ? document.exitFullscreen() : pa.requestFullscreen();pa.addEventListener('mousemove', (e) => {clearTimeout(timerId);btnMsg.style.display = 'block';timerId = setTimeout('btnMsg.style.display = "none"', 3000);});document.addEventListener('fullscreenchange', () => {if (document.fullscreenElement !== null) {fs = true;btnMsg.innerText = '退出全屏';} else {fs = false;btnMsg.innerText = '全屏观赏';}});};mkFS.FS = setFullScreen;})(this);
- let mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
- aud.addEventListener('pause', () => mState());
- aud.addEventListener('play', () => mState());
- mplayer.addEventListener('click', () => {
- aud.paused ? aud.play() : aud.pause();
- });
- FS({
- pa: papa,
- set: 'color: green; background: transparent; border: 2px solid green; bottom: 6px;',
- });
- })();
- </script>
复制代码
|
|