|
|

楼主 |
发表于 2025-6-1 18:05
|
显示全部楼层
帖子代码
- <style>
- #tz { --size: 9vw; margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); min-height: 80vh; aspect-ratio: 16/9; background: #eee url('https://638183.freep.cn/638183/t24/5/banax.jpg') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; }
- #player { position: absolute; width: var(--size); height: var(--size); cursor: pointer; background: none; border-radius: 50%; }
- #btnFs { bottom: 20px; color: #eee; text-align: center; }
- #btnFs:hover { color: red; }
- #vid {position: absolute; width: 100%; height: 100%; object-fit: cover; mask: radial-gradient(transparent 20%, red); -webkit-mask: radial-gradient(transparent 20%, red); pointer-events: none; }
- </style>
- <div id="tz">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=1955693518" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/24/11/01/15/25/07/video672482533234e.mp4" autoplay loop muted></video>
- <div id="player" title="播放/暂停"></div>
- </div>
- <script type="module">
- import * as THREE from 'https://638183.freep.cn/638183/3dev/build/three.module.min.js';
- import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
- const scene = new THREE.Scene();
- const clock = new THREE.Clock();
- const camera = new THREE.PerspectiveCamera(75, tz.offsetWidth / tz.offsetHeight, 0.1, 1000);
- camera.position.set(0, 0, 5);
- const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- tz.appendChild(renderer.domElement);
- let limit= 100, pos = 0, step = 1;
- const ambLight = new THREE.AmbientLight(0xffd700);
- const dirLight = new THREE.DirectionalLight(0xffffff, 2);
- dirLight.position.set(pos, 50, 100);
- const ball = new THREE.Mesh(
- new THREE.SphereGeometry(0.5),
- new THREE.MeshPhongMaterial({ color: 0xffffff, shininess: 40 })
- );
- ball.position.z = Math.sin(Math.PI * 0.5);
- const pan = new THREE.Mesh(
- new THREE.CircleGeometry(2, 20),
- new THREE.MeshLambertMaterial({ wireframe: true })
- );
- pan.rotateY(Math.PI / 5);
- scene.add(ball, pan, ambLight, dirLight);
- const animate = () => {
- requestAnimationFrame(animate);
- const delta = clock.getDelta();
- pos -= 100 * delta * step;
- if (pos > limit || pos < -limit) step = -step;
- dirLight.position.set(pos, 50, 100);
- pan.rotation.z += delta / 2;
- renderer.render(scene, camera);
- };
- window.onresize = () => {
- camera.aspect = tz.offsetWidth / tz.offsetHeight;
- camera.updateProjectionMatrix();
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- }
- aud.onplaying = aud.onpause = () => aud.paused ? clock.stop() : clock.start();
- animate();
- FS(tz, player);
- </script>
复制代码
|
评分
-
| 参与人数 2 | 威望 +80 |
金钱 +160 |
经验 +80 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
花飞飞
| + 30 |
+ 60 |
+ 30 |
很给力! |
查看全部评分
|