threejs(二) 移动,相机
来源:互联网 发布:php留言板视频教程 编辑:程序博客网 时间:2024/04/30 17:50
场景的移动
1.改变相机的位置,让物体移动
function animation(){ //renderer.clear(); camera.position.x =camera.position.x +1; renderer.render(scene, camera); requestAnimationFrame(animation);}
2.改变物体自身的位置,让物体移动
function animation(){ mesh.position.x-=1; renderer.render(scene, camera); requestAnimationFrame(animation); }
3.fps
stats = new Stats();stats.domElement.style.position = 'absolute';stats.domElement.style.left = '0px';stats.domElement.style.top = '0px';document.getElementById('canvas-frame').appendChild(stats.domElement);//调用stats.update()函数来统计时间和帧数,这个函数已经被封装好了
相机
1.在Threejs中相机的表示是THREE.Camera,它是相机的抽象基类,其子类有两种相机,分别是正投影相机THREE.OrthographicCamera和透视投影相机THREE.PerspectiveCamera。
2.正投影相机(平行投影)
//l,r,t,b,n,fvar camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );scene.add( camera );
3.透视投影相机
//PerspectiveCamera( fov, aspect, near, far )//视角fov:眼睛睁开的角度//近平面near:眼睛距离近处的距离//远平面far//纵横比aspect:实际窗口的纵横比,即宽度除以高度var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );scene.add( camera );
0 0
- threejs(二) 移动,相机
- Threejs开发笔记之九移动相机和动画
- ThreeJS中的相机
- ThreeJS中的相机
- 09.ThreeJs开发指南-第九章-创建动画和移动相机
- threejs相机和渲染器
- WebGL:二、ThreeJs 简介
- ThreeJs:二、简单立方体
- threejs
- threejs 鼠标移动控制模型旋转
- Threejs 三大组件 -- 场景、相机、渲染器
- 使用threejs点云秀出酷炫的图片效果(二)
- 【Unity】 相机移动脚本
- threejs中坐标系转换和实现物体跟随鼠标移动
- threejs第五篇【一条龙测试之二 threejs基本环境架设】
- 我的threejs学习笔记(三)——相机旋转
- unity相机跟随人物移动
- Unity3d相机跟随角色移动
- Arduino 101 IMU测试及问题
- 【2016杭电女生赛1009】【挖掘本质找关系 模拟】sum 找到最小的正整数,满足a乘sum(n)==b乘S(2n)
- Hibernate_一级缓存_Demo
- Linux C笔记之 作用域 详解
- [Java] 作业6(字符串)
- threejs(二) 移动,相机
- get请求和post请求的区别
- 【教程】Ubuntu安装cryptominisat教程
- 【2016杭电女生赛1010】【旅行商问题DP + 贪心】Ingress 最多走L距离 最多hackK次 的最大得分
- Android Drawable - Level List Drawable使用详解(附图)
- hihoCoder 1297 扩展欧几里德 && POJ 1061 青蛙的约会
- 【周总结】——转折
- C++第六次上机实验其他作业
- HDU 5690 All X