本帖最后由 花简静 于 2024-8-18 15:35 编辑
<style>
#tz {
--width: 1700px;
margin: 130px 0 30px calc(50% - (var(--width) / 2 + 90px));
width: var(--width);
height: 900px;
background: url('https://642303.freep.cn/642303/tu/062708.webp') no-repeat center/cover;
box-shadow: 3px 3px 8px rgba(0, 0, 0, .6);
overflow: hidden;
position: relative;
}
#player {
position: absolute;
display: grid;
place-items: center;
left: 15%;
top: 20%;
width: var(--ww);
height: var(--ww);
background: url('https://642303.freep.cn/642303/za/295d9e3e1fa74256950bf6903fd727ec_tplv-obj_540_540.gif') no-repeat 50%/96%;
border-radius: 100%;
cursor: pointer;
transition: .7s;
filter: hue-rotate(230deg);
mix-blend-mode: screen;
opacity: .99;
animation: rot 12s linear infinite var(--state);
--ww: 600px;
--size: 120px;
}
#player:hover { filter: hue-rotate(30deg); }
c-c {
position: absolute;
width: var(--size);
height: var(--size);
border-radius: 50%;
content: url('https://642303.freep.cn/642303/za/295d9e3e1fa74256950bf6903fd727ec_tplv-obj_540_540.gif') ;
box-shadow: 0 0 6px rgba(0, 0, 0, .1);
animation: flyout 6s forwards;
}
#vid {
position: absolute;
bottom: 0;
right:330px;
width: 100%;
height: calc(100% + 60px);
object-fit: cover;
mix-blend-mode: screen;
pointer-events: none;
opacity: .08;
}
#tz:fullscreen #vid { height: calc(100% + 100px); }
@keyframes flyout {
to { transform: rotate(var(--deg)) translateY(calc(var(--ww) / 2)); }
}
@keyframes flyin {
from { transform: rotate(var(--deg)) translateY(calc(var(--ww) / 2)); }
to { transform: rotate(calc(var(--deg) * 2)) translateY(0); }
}
@keyframes rot {
to { transform: rotate(360deg); }
}
</style>
<div id="tz">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1359338294" autoplay loop></audio>
<video id="vid" src="https://img.tukuppt.com/video_show/2414777/00/01/50/5b445b647f231.mp4" muted autoplay loop></video>
<div id="player" title="暂停"></div>
</div>
<script>
var ccs = [];
new Array(total = 12).fill(0).map((c,k) => {
c = document.createElement('c-c');
c.style.cssText += `--deg: ${360 / total * k}deg`;
player.appendChild(c);
ccs.push(c);
});
var mState = () => {
player.style.setProperty('--state', aud.paused ? 'paused' : 'running');
player.title = ['暂停','播放'][+aud.paused];
ccs.forEach(cc => cc.style.animationName = aud.paused ? 'flyin' : 'flyout');
aud.paused ? vid.pause() : vid.play();
};
aud.oncanplay = aud.onplaying = aud.onpause = () => mState();
player.onclick = () => aud.paused ? aud.play() : aud.pause();
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: '#tz',
css: 'bottom: 20px; left: 95%; transform: translate(-50%); --color:snow; --fsBg:transparency;',
});
</script>
|