欧若拉(学习马黑黑Between Two Worlds效果)
<style>#papa { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); height: auto; aspect-ratio: 16/9; background: #333 url('https://pic1.imgdb.cn/item/686bd1e458cb8da5c8952492.webp') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; perspective: 600px; transform-style: preserve-3d; overflow: hidden; z-index: 1; position: relative; --state: running; --hh: 190px; }
.son { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(35deg, tan, skyblue); opacity: 0; filter: drop-shadow(4px 6px 8px #333;); cursor: pointer; }
#btnFs { bottom: 30px; color: silver; border-color: silver !important; }
#vid {position: absolute; width: 100%; height: 100%; object-fit: cover; mask: radial-gradient(transparent 20%, red); -webkit-mask: radial-gradient(transparent 20%, red); opacity: .6; pointer-events: none; }
#player { position: absolute; width: 200px; height: 200px; filter: drop-shadow(0 0 4px gray); display: grid; place-items: center; }
#player::before, #player::after { position: absolute; content: ''; }
#player::before { width: 6px; height: var(--hh); background: linear-gradient(to right, tan, yellow, tan); top: 50%; }
#player::after { width: 100%; height: 100%; background: url('https://638183.freep.cn/638183/small/fi1.webp') no-repeat center/cover; transform: rotateX(45deg) rotateY(5deg) rotateZ(0); cursor: pointer; animation: rot3d 6s linear infinite var(--state); }
@keyframes rot3d { to { transform: rotateX(45deg) rotateY(5deg) rotateZ(360deg); } }
</style>
<div id="papa">
<audio id="aud" src="https://file.uhsea.com/2507/f7c807192d65eccbcc79c07d79a497faBU.mp3" autoplay="" loop=""></audio>
<video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/22/11/03/05/45/26/video6362e4f65d2be.mp4" autoplay loop muted></video>
<div id="player"></div>
</div>
<script type="module">
import TWEEN from 'https://638183.freep.cn/638183/3dev/examples/jsm/libs/tween.module.js';
import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
let sons = [], tweens = [], total = 40, time = 2000;
let target = { x: papa.clientWidth / 4, z: 300, a: 27 };
Array.from({length: total}).forEach(son => {
son = document.createElement('div');
son.className = 'son';
son.title = 'Alt+X';
son.onclick = () => player.click();
son.style.cssText += `
background: linear-gradient(
35deg,
#${Math.random().toString(16).substring(2,8)},
#${Math.random().toString(16).substring(2,8)}
);
`;
sons.push(son);
papa.appendChild(son);
});
sons.forEach( (son, key) => {
const pos = { x: 0, z: 0, a: 0 };
const ax = key % 2 === 0 ? 126 : 0;
const tween = new TWEEN.Tween(pos)
.to(target, time)
.onUpdate( () => {
son.style.setProperty(
'transform',
`rotateZ(${pos.a + ax}deg) translate3d(${pos.x}px, 0, ${pos.z}px)`
);
})
.onStart( () => {
son.style.setProperty('opacity', 0.8);
})
.onComplete ( () => {
setTimeout( () => {
if (!aud.paused) son.style.setProperty('opacity', 0);
}, time * 2);
})
.dynamic(true);
tweens.push(tween);
});
tweens.forEach( (tween, key) => {
tween.chain(tweens[(key + 1) % tweens.length]);
});
const animate = () => {
TWEEN.update();
requestAnimationFrame(animate);
};
aud.onplaying = aud.onpause = () => {
tweens.forEach(tween => aud.paused ? tween.pause() : tween.resume());
};
window.onresize = () => {
target.x = papa.clientWidth / 4;
papa.style.setProperty('--hh', 190 * papa.clientHeight / 788 + 'px');
}
tweens.start();
animate();
FS(papa, player);
papa.style.setProperty('--hh', 190 * papa.clientHeight / 788 + 'px');
</script> @马黑黑
老师 晚上好,学生交作业,请指正{:4_190:} {:4_199:} 问好老师,欣赏精美的音画制作 。{:4_199:} 漂亮,欣赏朵宝好帖{:4_204:}
页:
[1]