|
|

楼主 |
发表于 2025-6-30 18:12
|
显示全部楼层
帖子代码
- <style>
- #papa { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); height: auto; aspect-ratio: 16/9; background: #000; 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: 16vw; height: 16vw; border-radius: 50%; transform: translate(10px, -20px); cursor: pointer; z-index: 91; }
- #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; z-index: 90; }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1984625" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/25/04/08/17/14/59/video67f4e91361a39.mp4" autoplay loop muted></video>
- <div id="player" title="播放/暂停"></div>
- </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 map = new THREE.TextureLoader().load('https://638183.freep.cn/638183/t24/w4/lzlx.webp');
- map.colorSpace = THREE.SRGBColorSpace;
- const planeGeometry = new THREE.PlaneGeometry(8, 4.5);
- const planeMaterial = new THREE.MeshBasicMaterial({ map: map });
- const plane = new THREE.Mesh(planeGeometry, planeMaterial);
- const geometry1 = new THREE.TorusGeometry(0.4, 0.2, 40, 40); // 几何体1
- geometry1.translate(-3, 0, 0); // 位置调整
- const geometry2 = new THREE.TorusGeometry(0.4, 0.2, 40, 40); // 几何体2(仅取其点数据)
- geometry2.translate(3, 0, 0); // 位置调整
- const pointsMaterial = new THREE.PointsMaterial({
- size: 0.05, // 尺寸
- color: 'cyan', // 颜色
- transparent: true, // 开启透明度
- opacity: 0.3 // 透明设置
- });
- const points = new THREE.Points(geometry1, pointsMaterial); // 用几何体1构图
- scene.add(plane, points);
- const startPositions = geometry1.attributes.position; // tween动画起始位置数组
- const endPositions = geometry2.attributes.position; // tween动画终点位置数组
- const total = startPositions.count; // 点云的点数量
- // tween动画设计 : 点位置交换规则 [a,b,c] → [c,b,a]
- for(let i = 0; i < startPositions.count; i++) {
- if (i % 10 === 0) continue; // 跳过被10整除的点
- 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();
- plane.rotation.z += 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 |
收起
理由
|
泡沫
| + 20 |
+ 40 |
+ 20 |
很给力! |
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|