strve+three实现三维开发示例代码
代码语言:html
所属分类:三维
代码描述:strve+three实现三维开发示例代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; } canvas { width: 100%; height: 100%; display: block; } </style> </head> <body translate="no"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/strve.full.prod.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.148.js"></script> <script> const { html, createApp, onMounted, domInfo } = Strve; function App() { return html` <div id="three" $ref="three"></div> ` } //声明一些全局变量 var renderer, camera, scene, geometry, material, mesh; //初始化渲染器 function initRenderer() { renderer = new THREE.WebGLRenderer(); //实例化渲染器 renderer.setSize(window.innerWidth, window.innerHeight); //设置宽和高 domInfo['three'].appendChild(renderer.domElement); //添加到dom } //初始化场景 function initScene() { scene = new THREE.Scene(); //实例化场景 } //初始化相机 function initCamera() .........完整代码请登录后点击上方下载按钮下载查看
网友评论0