|
|

楼主 |
发表于 2025-6-22 13:45
|
显示全部楼层
帖子代码
- <style>
- #papa { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); height: auto; aspect-ratio: 16/9; background: url('https://638183.freep.cn/638183/t24/w4/xu.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: #eee; }
- #player { position: absolute; left: -1000px; }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=547117901" autoplay loop></audio>
- <div id="player"></div>
- </div>
- <script type="module">
- import { THREE, scene, camera, renderer, clock, basic3, click3 } from 'https://638183.freep.cn/638183/3dev/3/3basic.js';
- import { textcanvas } from 'https://638183.freep.cn/638183/3dev/3/textcanvas1.js';
- import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
- basic3(papa);
- const group = new THREE.Group();
- group.position.set(0, 0, -2);
- const spriteTexture = new THREE.TextureLoader().load('https://638183.freep.cn/638183/t22/51/hx.png');
- spriteTexture.colorSpace = THREE.SRGBColorSpace;
- for (let i = 0; i < 100; i ++) {
- const sprite = new THREE.Sprite(new THREE.SpriteMaterial({ color: 0xffff00, map: spriteTexture }));
- sprite.position.set(
- THREE.MathUtils.randFloatSpread(10),
- THREE.MathUtils.randFloatSpread(6),
- THREE.MathUtils.randFloatSpread(10)
- );
- sprite.scale.set(0.25, 0.25, 0.25);
- sprite.material.rotation = Math.random() * Math. PI;
- group.add(sprite);
- }
- const setting = {
- font: `bold 60px 'KaiTi', sans-serif`,
- fill: true,
- fillColor: '#ff0000',
- bg: 'rgba(169,164,60, 0.8)',
- padding: { x: 5, y: 65 },
- shadowX: 3,
- shadowY: 3
- };
- const canv = textcanvas('* 如 期 而 至 *', setting);
- const texture = new THREE.CanvasTexture(canv);
- const mesh = new THREE.Mesh(
- new THREE.SphereGeometry(),
- new THREE.MeshBasicMaterial({ map: texture })
- );
- mesh.position.set(-1, -1, -1.5);
- scene.add(group, mesh);
- const animate = () => {
- requestAnimationFrame(animate);
- const delta = clock.getDelta();
- mesh.rotation.y -= delta;
- group.rotation.y -= delta / 10;
- renderer.render(scene, camera);
- };
- papa.onclick = (e) => {if (click3(mesh, e)) player.click()};
- papa.onmousemove = (e) => {
- papa.title = click3(mesh, e) ? '播放/暂停(Alt+X)' : '';
- papa.style.cursor = click3(mesh, e) ? 'pointer' : 'default';
- };
- aud.onplaying = aud.onpause = () => aud.paused ? clock.stop() : clock.start();
- animate();
- FS(papa, player);
- </script>
复制代码
|
评分
-
| 参与人数 1 | 威望 +50 |
金钱 +100 |
经验 +50 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|