|
|

楼主 |
发表于 2025-6-5 20:16
|
显示全部楼层
帖子代码
- <style>
- #tz { 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/webp3/qqci.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: 15vw; height: auto; aspect-ratio: 1/1; cursor: pointer; background: none; border-radius: 50%; transform: translateX(-20px); }
- #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=75380" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/23/09/15/19/16/59/video65043d2b7691a.mp4" autoplay loop muted></video>
- <div id="player" title="播放/暂停"></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 * as THREE from 'three';
- import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
- import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
- import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.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(60, tz.offsetWidth / tz.offsetHeight, 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 texture = new THREE.TextureLoader().load('https://638183.freep.cn/638183/small/gt100.jpg');
- texture.colorSpace = THREE.SRGBColorSpace;
- const box = new THREE.Mesh(
- new THREE.BoxGeometry(),
- new THREE.MeshBasicMaterial({ map: texture })
- );
- const mesh = new THREE.Mesh(
- new THREE.CylinderGeometry(0.8, 1, 1, 16, 1),
- new THREE.MeshBasicMaterial({ wireframe: true })
- );
- mesh.add(box);
- mesh.position.set(-0.15, 0, 0);
- scene.add(mesh);
- const composer = new EffectComposer(renderer);
- const renderPass = new RenderPass(scene, camera);
- composer.addPass(renderPass);
- const outlinePass = new OutlinePass(new THREE.Vector2(tz.offsetWidth, tz.offsetHeight), scene, camera);
- outlinePass.visibleEdgeColor.set(0xffff88);
- outlinePass.edgeThickness = 8;
- outlinePass.edgeStrength = 10;
- outlinePass.pulsePeriod = 0.5;
- outlinePass.selectedObjects = [mesh];
- composer.addPass(outlinePass);
- const animate = (currentTime) => {
- const delta = clock.getDelta();
- mesh.rotation.y -= delta / 5;
- composer.render();
- requestAnimationFrame(animate);
- };
- aud.onplaying = aud.onpause = () => aud.paused ? (clock.stop(), outlinePass.pulsePeriod = 0) : (clock.start(), outlinePass.pulsePeriod = 0.5);
- animate();
- FS(tz, player);
- </script>
复制代码
|
评分
-
| 参与人数 2 | 威望 +80 |
金钱 +160 |
经验 +80 |
收起
理由
|
花飞飞
| + 30 |
+ 60 |
+ 30 |
很给力! |
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
查看全部评分
|