|
|

楼主 |
发表于 2025-5-19 12:17
|
显示全部楼层
帖子代码
- <style>
- #tz { --size: 240px; margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); min-height: 80vh; aspect-ratio: 16/9; background: url('https://638183.freep.cn/638183/t24/webp3/rasa.webp') 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"></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/25/03/24/13/59/50/video67e0f4d65647e.mp4" autoplay loop muted></video>
- <div id="player" title="播放/暂停"></div>
- </div>
- <script type="module">
- import * as THREE from 'https://638183.freep.cn/638183/web/ku/three.module.min.js';
- import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
-
- const musics = [
- 'https://music.163.com/song/media/outer/url?id=2110535068',
- 'https://music.163.com/song/media/outer/url?id=2101386665',
- 'https://music.163.com/song/media/outer/url?id=2062300396',
- 'https://music.163.com/song/media/outer/url?id=2094442975',
- 'https://music.163.com/song/media/outer/url?id=2699342733'
- ];
- let currentIdx = 0;
- const playmusic = () => {
- aud.src = musics[currentIdx];
- aud.play();
- currentIdx = (currentIdx + 1) % musics.length;
- };
- const scene = new THREE.Scene;
- const clock = new THREE.Clock();
- const camera = new THREE.PerspectiveCamera(60, 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);
- const texture1 = new THREE.TextureLoader().load('https://638183.freep.cn/638183/t24/webp3/rasa.webp');
- const texture2 = new THREE.TextureLoader().load('https://638183.freep.cn/638183/t24/webp/girl.webp');
- texture1.colorSpace = THREE.SRGBColorSpace;
- texture2.colorSpace = THREE.SRGBColorSpace;
- const ball = new THREE.Mesh(
- new THREE.SphereGeometry(),
- new THREE.MeshBasicMaterial({ map: texture1, transparent: true, opacity: .7, side: THREE.DoubleSide })
- );
- const circle = new THREE.Mesh(
- new THREE.CircleGeometry(0.8),
- new THREE.MeshBasicMaterial({ map: texture2, side: THREE.DoubleSide })
- );
- const circle1 = circle.clone();
- circle1.rotateY(Math.PI / 2);
- ball.add(circle, circle1);
- scene.add(ball);
- const animate = () => {
- requestAnimationFrame(animate);
- const delta = clock.getDelta();
- ball.rotation.y -= delta;
- renderer.render(scene, camera);
- };
- tz.onclick = (e) => {
- if (e.target.id !== 'player') return;
- aud.paused ? clock.stop() : clock.start();
- }
- aud.onended = () => playmusic();
- window.onresize = () => {
- camera.aspect = tz.offsetWidth / tz.offsetHeight;
- camera.updateProjectionMatrix();
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- tz.style.setProperty('--size', `${tz.offsetWidth / 5}px`);
- }
- animate();
- playmusic();
- FS(tz, player);
- </script>
复制代码
|
评分
-
| 参与人数 3 | 威望 +130 |
金钱 +260 |
经验 +130 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
花飞飞
| + 30 |
+ 60 |
+ 30 |
很给力! |
小辣椒
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|