|
|

楼主 |
发表于 2025-7-4 13:00
|
显示全部楼层
本帖最后由 马黑黑 于 2025-7-4 17:49 编辑
帖子代码
- <style>
- #papa { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); height: auto; aspect-ratio: 16/9; background: snow url('https://638183.freep.cn/638183/t24/6/stage.jpg') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; --state: running; }
- #btnFs { bottom: 30px; color: cyan; border-color: cyan !important; }
- #player { position: absolute; left: -1000px; }
- #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; }
- </style>
- <div id="papa">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=2077537719" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/22/11/03/14/51/00/video636364d43e50d.mp4" autoplay loop muted></video>
- <div id="player"></div>
- </div>
- <script type="importmap">
- {
- "imports": {
- "three": "https://638183.freep.cn/638183/3dev/build/three.module.min.js",
- "three/addons/": "https://638183.freep.cn/638183/3dev/examples/jsm/"
- }
- }
- </script>
- <script type="module">
- import { THREE, scene, camera, renderer, clock, basic3, click3 } from 'https://638183.freep.cn/638183/3dev/3/3basic.js?v=1.0';
- import { OrbitControls } from "three/addons/controls/OrbitControls.js";
- import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
- import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
- basic3(papa);
- renderer.outputEncoding = THREE.sRGBEncoding;
- const controls = new OrbitControls(camera, renderer.domElement);
- let mixer, model, startTime = 0, actions = [];
- const url = 'https://638183.freep.cn/638183/web/3models/RobotExpressive.glb';
- scene.add(new THREE.AmbientLight());
- new GLTFLoader().load(url, gltf => {
- model = gltf.scene;
- const scale = 0.5;
- model.scale.set(scale, scale, scale);
- model.position.y -= 2;
- scene.add(model);
- mixer = new THREE.AnimationMixer(model);
- if (gltf.animations.length > 0) {
- gltf.animations.forEach(a => actions.push(a));
- playModel();
- }
- animate();
- });
- function animate() {
- requestAnimationFrame(animate);
- camera.lookAt(0, 0, 0);
- const delta = clock.getDelta();
- mixer.update(delta);
- renderer.render(scene, camera);
- }
- function playModel(idx = null) {
- const playIdx = idx !== null ? idx : Math.floor(Math.random() * actions.length);
- for (let k = 0; k < actions.length; k ++) {
- const clip = mixer.clipAction(actions[k]);
- k === playIdx ? clip.play() : clip.stop();
- }
- }
- aud.onplaying = aud.onpause = () => {
- aud.paused ? clock.stop() : clock.start();
- };
- papa.onmousedown = () => startTime = Date.now();
- papa.onmouseup = (e) => {
- if (!click3(model, e)) return;
- if (Date.now() - startTime < 300) player.click();
- };
- papa.onmousemove = (e) => {
- papa.title = click3(model, e) ? '播放/暂停(Alt+X)' : '';
- papa.style.cursor = click3(model, e) ? 'pointer' : 'default';
- };
- setInterval(playModel, 10000);
- FS(papa, player);
- </script>
复制代码
|
评分
-
| 参与人数 2 | 威望 +80 |
金钱 +160 |
经验 +80 |
收起
理由
|
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
花飞飞
| + 30 |
+ 60 |
+ 30 |
很给力! |
查看全部评分
|