|
|

楼主 |
发表于 2025-7-1 20:21
|
显示全部楼层
帖子代码
- <style>
- #papa { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); height: auto; aspect-ratio: 16/9; background: snow url('https://638183.freep.cn/638183/t24/w4/galaxy.webp') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; }
- #btnFs { bottom: 30px; color: cyan; border-color: cyan !important; }
- #player { position: absolute; width: 10vw; height: 10vw; border-radius: 50%; filter: drop-shadow(0 0 80px #000) opacity(0.5); cursor: pointer; z-index: 2; animation: rot 8s linear infinite var(--state); }
- #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; }
- @keyframes rot { to { transform: rotate(360deg); } }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1971315292" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/25/03/24/13/59/29/video67e0f4c17e4d2.mp4" autoplay loop muted></video>
- <img id="player" src="https://638183.freep.cn/638183/small/2025/b3.webp" title="播放/暂停" alt="" />
- </div>
- <script type="module">
- import { THREE, scene, camera, renderer, clock, basic3 } from 'https://638183.freep.cn/638183/3dev/3/3basic.js?v=1.0';
- 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';
- basic3(papa, aud.paused);
- const texture = new THREE.TextureLoader().load(`data:image/svg+xml;charset=utf-8, <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="white"/></svg>`);
- texture.colorSpace = THREE.SRGBColorSpace;
- texture.center.set(0.5,0.5);
- const geometry1 = new THREE.SphereGeometry(0.5, 32, 32); // 几何体1
- geometry1.translate(-1.5, -1, 0);
- geometry1.rotateX(Math.PI / 6);
- const geometry2 = new THREE.SphereGeometry(0.5, 32, 32); // 几何体2
- geometry2.translate(1.5, 1, 1);
- geometry2.rotateX(-Math.PI / 6);
- const startPositions = geometry1.attributes.position;
- const endPositions = geometry2.attributes.position;
- const pointsGeometry = new THREE.BufferGeometry();
- pointsGeometry.setAttribute('position', startPositions);
- const pointsMaterial = new THREE.PointsMaterial({ map: texture, size: 0.1, transparent: true });
- const points = new THREE.Points(pointsGeometry, pointsMaterial);
- scene.add(points);
- const total = startPositions.count;
- for(let i = 0; i < total; i++) {
- const tween = new TWEEN.Tween(startPositions.array)
- .to({
- [i * 3]: endPositions.array[(total - i - 1) * 3],
- [i * 3 + 1]: endPositions.array[(total -i - 1) * 3 + 1],
- [i * 3 + 2]: endPositions.array[(total -i - 1) * 3 + 2]
- }, 5000 * Math.random() + 5000)
- .delay(2000)
- .easing(TWEEN.Easing.Exponential.Out)
- .onUpdate(() => startPositions.needsUpdate = true)
- .repeat(Infinity)
- .repeatDelay(1500)
- .yoyo(3000)
- .start();
- }
- const animate = () => {
- TWEEN.update();
- const delta = clock.getDelta();
- points.rotation.z += delta / 5;
- points.rotation.y += delta / 5;
- renderer.render(scene, camera);
- requestAnimationFrame(animate);
- };
- const tweens = TWEEN.getAll();
- aud.onplaying = aud.onpause = () => {
- tweens.forEach(tween => aud.paused ? tween.pause() : tween.resume());
- aud.paused ? clock.stop() : clock.start();
- };
- animate();
- FS(papa, player);
- </script>
复制代码
|
评分
-
| 参与人数 2 | 威望 +70 |
金钱 +140 |
经验 +70 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
泡沫
| + 20 |
+ 40 |
+ 20 |
很给力! |
查看全部评分
|