|
|

楼主 |
发表于 2025-5-14 20:28
|
显示全部楼层
本帖最后由 马黑黑 于 2025-5-14 21:04 编辑
帖子代码
- <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/5/qmyb.jpg') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; }
- #btnFs { right: 20px; top: 20px; text-align: center; color: darkgreen; border-color: teal !important; }
- #btnFs:hover { color: red; }
- #player { position: absolute; z-index: 10; cursor: pointer; animation: rot 8s infinite linear var(--state); }
- #player:hover { filter: hue-rotate(60deg); }
- #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; }
- @keyframes rot { to { transform: rotate(360deg); } }
- </style>
- <div id="tz">
- <audio id="aud" src="https://music.163.com/song/media/outer/url?id=5275053" autoplay loop></audio>
- <video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/22/11/05/03/10/58/video636563c24169e.mp4" autoplay loop muted></video>
- <img id="player" src="https://638183.freep.cn/638183/small/fi1.webp" width="10%" title="播放/暂停" />
- </div>
- <script type="module">
- import * as THREE from 'https://esm.sh/three';
- import { FS } from 'https://638183.freep.cn/638183/web/ku/fscreen.js';
- let step = 0.01, pos = 0, isPaused = false, raf;
- let playerLeft = (tz.offsetWidth - player.offsetWidth) / 2;;
- const scene = new THREE.Scene;
- const camera = new THREE.PerspectiveCamera(75, tz.offsetWidth / tz.offsetHeight, 0.1, 1000);
- camera.position.set(0, 8, 20);
- const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- tz.appendChild(renderer.domElement);
- const geometry = new THREE.CylinderGeometry(1, 1, 10, 16);
- const texture = new THREE.TextureLoader().load('https://638183.freep.cn/638183/small/texture/wd3.jpg', () => renderer.render(scene, camera));
- const material = new THREE.MeshBasicMaterial({ color: 'tan', map: texture });
- const cylinder = new THREE.Mesh(geometry, material);
- cylinder.rotateX(2);
- scene.add(cylinder);
- const animate = () => {
- pos -= step;
- let xx = playerLeft + pos * 15;
- player.style.setProperty('left', xx + 'px');
- if(pos >= 15 || pos <= -15) step = -step;
- cylinder.rotation.y += step;
- cylinder.position.x = pos;
- renderer.render(scene, camera);
- isPaused ? raf = requestAnimationFrame(animate) : cancelAnimationFrame(raf);
- };
- window.onresize = () => {
- renderer.setSize(tz.offsetWidth, tz.offsetHeight);
- playerLeft = (tz.offsetWidth - player.offsetWidth) / 2;
- };
- const mState = () => {
- isPaused = !aud.paused;
- animate();
- };
- aud.onplaying = aud.onpause = () => mState();
- aud.onseeked = () => cancelAnimationFrame(raf);
- animate();
- FS(tz, player);
- </script>
复制代码
|
评分
-
| 参与人数 3 | 威望 +130 |
金钱 +260 |
经验 +130 |
收起
理由
|
小辣椒
| + 50 |
+ 100 |
+ 50 |
赞一个! |
红影
| + 50 |
+ 100 |
+ 50 |
赞一个! |
花飞飞
| + 30 |
+ 60 |
+ 30 |
很给力! |
查看全部评分
|