three实现三维星空闪耀流逝动画代码
代码语言:html
所属分类:三维
代码描述:three实现三维星空闪耀流逝动画代码
代码标签: three 实现 三维 星空 闪耀 流逝 动画 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body{ background-color: black; overflow: hidden; } canvas{ position: fixed; top: 0; left: 0; } </style> </head> <body translate="no"> <canvas id="bg1"></canvas> <script type="importmap"> { "imports": { "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/166/three.module.js", "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/166/jsm/" } } </script> <script type="module"> import * as THREE from "three"; import { OrbitControls } from "three/addons/controls/OrbitControls.js"; const scene = new THREE.Scene() scene.background = new THREE.Color(0x000); const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); camera.position.setZ(30); const renderer = new THREE.WebGLRenderer({ canvas: document.querySelector("#bg1"), }) renderer.setSize(window.innerWidth, window.innerHeight); renderer.setPixelRatio(window.devicePixelRatio); renderer.render(scene, camera); const controls = new OrbitControls(camera, renderer.domElement); controls.update() .........完整代码请登录后点击上方下载按钮下载查看
网友评论0