three实现4000个三维小行星球体压缩在立方体内旋转动画效果代码
代码语言:html
所属分类:三维
代码描述:three实现4000个三维小行星球体压缩在立方体内旋转动画效果代码
代码标签: three 三维 小行星 球体 压缩 立方体 旋转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html, body { margin: 0; height: 100%; background: #1a1a1a; } #log { position: absolute; bottom: 0; right: 0; padding: 0.5em 0.75em; font-size: 12px; font-family: monospace; white-space: pre-line; text-align: right; color: grey; } </style> </head> <body translate="no"> <div id="log">packing 4000 spheres...</div> <canvas id="canvas"></canvas> <script type="module"> import { Color, DirectionalLight, HemisphereLight, InstancedMesh, MeshLambertMaterial, Object3D, OrthographicCamera, PCFSoftShadowMap, Quaternion, Scene, SphereGeometry, Vector3, WebGLRenderer } from "//repo.bfw.wiki/bfwrepo/js/module/three/build/169/three.module.js"; const N = 4000; const MIN_R = 0.005; const MAX_R = 0.5; const min = Math.min; const abs = Math.abs; //////// SETUP const scene = new Scene(); scene.background = new Color(0.01, 0.01, 0.01); let asp = innerWidth / innerHe.........完整代码请登录后点击上方下载按钮下载查看
网友评论0