three实现三维空间激光雷达扫描动画效果代码
代码语言:html
所属分类:三维
代码描述:three实现三维空间激光雷达扫描动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body{ overflow: hidden; margin: 0; } </style> </head> <body > <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.133.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.133.js"></script> <script > console.clear(); let scene = new THREE.Scene(); let camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.1, 1000); camera.position.set(0, 2, 5); let renderer = new THREE.WebGLRenderer({antialias: true}); renderer.setSize(innerWidth, innerHeight); document.body.appendChild(renderer.domElement); window.addEventListener("resize", event => { camera.aspect = innerWidth / innerHeight; camera.updateProjectionMatrix(); renderer.setSize(innerWidth, innerHeight); }) let controls = new THREE.OrbitControls(camera, renderer.domElement); let gu = { time: {value: 0} } scene.add(new THREE.GridHelper()); let r = 0.1, R = 20, halfAngle = THREE.MathUtils.degToRad(45); let g = new THREE.PlaneGeometry(1, 1, 72, 20); let pos = g.attributes.position; let uv = g.attributes.uv; for(let i = 0; i < pos.count; i++){ let y = 1. - uv.getY(i); let radius = r + (R - r) * y; let x = pos.getX(i); pos.setXY(i, Math.cos(x * halfAngle) * radius, Math.sin(x * halfAngle) * radius).........完整代码请登录后点击上方下载按钮下载查看
网友评论0