|
|

楼主 |
发表于 2025-5-16 20:11
|
显示全部楼层
本帖最后由 马黑黑 于 2025-5-16 21:39 编辑
帖子代码(刚刚更换了 three.js 模块资源):
- <style>
- #tz { --state: running; 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/e.webp') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; }
- #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; }
- #player { position: absolute; top: 20px; right: 20px; z-index: 10; filter: hue-rotate(60deg); opacity: .7; transition: filter .7s; cursor: pointer; animation: rot 8s infinite linear var(--state); }
- #player:hover { filter: unset; }
- @keyframes rot { to { transform: rotate(360deg); } }
- </style>
- <div id="tz">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=2051382659" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/25/03/19/17/38/49/video67da90a941c5f.mp4" autoplay loop muted></video>
- <img id="player" src="https://638183.freep.cn/638183/small/fi2.webp" width="10%" title="播放/暂停" />
- </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/fscreen.js';
- let isPlaying = true, raf;
- const scene = new THREE.Scene;
- const camera = new THREE.PerspectiveCamera(75, tz.offsetWidth / tz.offsetHeight, 0.1, 1000);
- camera.position.set(0, 0, 10);
- const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- tz.appendChild(renderer.domElement);
- const ring_geometry = new THREE.RingGeometry();
- const torus_geometry = new THREE.TorusGeometry();
- const material = new THREE.MeshNormalMaterial({ side: THREE.DoubleSide });
- const ring_mess = new THREE.Mesh(ring_geometry, material);
- const torus_mess = new THREE.Mesh(torus_geometry, material);
- const torus_mess1 = torus_mess.clone();
- torus_mess.position.set(3, 0, 0);
- torus_mess1.position.set(-3, 0, 0);
- ring_mess.add(torus_mess, torus_mess1);
- ring_mess.rotateY(0.5);
- scene.add(ring_mess);
- const animate = () => {
- isPlaying ? raf = requestAnimationFrame(animate) : cancelAnimationFrame(raf);
- ring_mess.rotation.x += 0.01;
- ring_mess.rotation.y += 0.01;
- renderer.render(scene, camera);
- };
- window.onresize = () => {
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- renderer.render(scene, camera);
- };
- tz.onclick = (e) => {
- if (e.target.id !== 'player') return;
- isPlaying = !aud.paused;
- animate();
- };
- aud.onseeked = () => cancelAnimationFrame(raf);
- isPlaying = !aud.paused;
- animate();
- FS(tz, player);
- </script>
复制代码
|
评分
-
| 参与人数 3 | 威望 +130 |
金钱 +260 |
经验 +130 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
小辣椒
| + 50 |
+ 100 |
+ 50 |
赞一个! |
花飞飞
| + 30 |
+ 60 |
+ 30 |
很给力! |
查看全部评分
|