<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - path controls</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
color: #000;
font-family:Monospace;
font-size:13px;
text-align:center;
font-weight: bold; background-color: #fff;
margin: 0px;
overflow: hidden;
} #info {
color:#000;
position: absolute;
top: 0px; width: 100%;
padding: 5px; } a { color: red; } </style>
</head> <body>
<div id="container"></div>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - path controls example</br>
mouse look around
</div> <script src="../build/three.min.js"></script> <script src="js/controls/PathControls.js"></script> <script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script> <script> if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); var container, stats; var camera, controls, scene, renderer; var cross; var clock = new THREE.Clock(); init();
animate(); function init() { camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 ); controls = new THREE.PathControls( camera ); controls.waypoints = [ [ -500, 0, 0 ], [ 0, 200, 0 ], [ 500, 0, 0 ] ];
controls.duration = 28
controls.useConstantSpeed = true;
//controls.createDebugPath = true;
//controls.createDebugDummy = true;
controls.lookSpeed = 0.06;
controls.lookVertical = true;
controls.lookHorizontal = true;
controls.verticalAngleMap = { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 1.1, 3.8 ] };
controls.horizontalAngleMap = { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 0.3, Math.PI - 0.3 ] };
controls.lon = 180; controls.init(); // world scene = new THREE.Scene();
scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); scene.add( controls.animationParent ); var geometry = new THREE.CylinderGeometry( 0, 10, 30, 4, 1 );
var material = new THREE.MeshLambertMaterial( { color:0xffffff, shading: THREE.FlatShading } ); for ( var i = 0; i < 500; i ++ ) { var mesh = new THREE.Mesh( geometry, material );
mesh.position.x = ( Math.random() - 0.5 ) * 1000;
mesh.position.y = ( Math.random() - 0.5 ) * 1000;
mesh.position.z = ( Math.random() - 0.5 ) * 1000;
mesh.updateMatrix();
mesh.matrixAutoUpdate = false;
scene.add( mesh ); } // lights light = new THREE.DirectionalLight( 0xffffff );
light.position.set( 1, 1, 1 );
scene.add( light ); light = new THREE.DirectionalLight( 0x002288 );
light.position.set( -1, -1, -1 );
scene.add( light ); light = new THREE.AmbientLight( 0x222222 );
scene.add( light ); // renderer renderer = new THREE.WebGLRenderer( { antialias: false } );
renderer.setClearColor( scene.fog.color, 1 );
renderer.setSize( window.innerWidth, window.innerHeight ); container = document.getElementById( 'container' );
container.appendChild( renderer.domElement ); // stats stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
stats.domElement.style.zIndex = 100;
container.appendChild( stats.domElement ); // window.addEventListener( 'resize', onWindowResize, false ); // start animation controls.animation.play( true, 0 ); } function onWindowResize() { camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight ); controls.handleResize(); } function animate() { requestAnimationFrame( animate ); render();
stats.update(); } function render() { var delta = clock.getDelta(); THREE.AnimationHandler.update( delta ); controls.update( delta );
renderer.render( scene, camera ); } </script> </body>
</html>

threejs path controls example html的更多相关文章

  1. 重新想象 Windows 8.1 Store Apps (81) - 控件增强: WebView 之加载本地 html, 智能替换 html 中的 url 引用, 通过 Share Contract 分享 WebView 中的内容, 为 WebView 截图

    [源码下载] 重新想象 Windows 8.1 Store Apps (81) - 控件增强: WebView 之加载本地 html, 智能替换 html 中的 url 引用, 通过 Share Co ...

  2. 重新想象 Windows 8.1 Store Apps (81) - 控件增强: 加载本地 html, 智能替换 html 中的 url 引用, 通过 Share Contract 分享 WebView 中的内容, 为 WebView 截图

    原文:重新想象 Windows 8.1 Store Apps (81) - 控件增强: 加载本地 html, 智能替换 html 中的 url 引用, 通过 Share Contract 分享 Web ...

  3. HTML第二篇

    1>压缩文件格式:使用.zip格式较好 2>charset(字符集)  国内最新字符集格式为:gb18030   国际上通用的字符集是:UTF-8 3>添加图片 <img sr ...

  4. 附加属性来控制控件中,要扩展模块的visibility

    可解决: 文本框控件中的按钮,DataGridColumnHeader中加入Filter控件... cs文件中的 附加属性 + 样式文件中的 template+控件 -> visibility ...

  5. 深入浅出WPF-11.Template(模板)01

    模板 在WPF中,模板可以分为两大类: 控件模板(ControlTemplate)是算法内容的表现形式,一个控件怎么组织其内部的结构才能让它更符合业务逻辑,让用户操作更舒服,都是由她控制的.它决定了控 ...

  6. WebGL和ThreeJs学习5--ThreeJS基本功能控件

      Threejs 2017年6月6日 15:06 Stats: new Stats();性能监视器,性能测试的方法,引入 Stats.js        http://www.hewebgl.com ...

  7. threejs和3d各种效果的学习

    写给即将开始threejs学习的自己,各种尝试,各种记忆.不要怕,灰色的年华终会过去. 一个技术学习的快慢,以及你的深刻程度,还有你的以后遇到这个东西的时候的反应速度,很大程度上,取决于你的博客的深刻 ...

  8. threeJS创建mesh,创建平面,设置mesh的平移,旋转、缩放、自传、透明度、拉伸

    这个小案例是当初我在学习的时候,小的一个小案例,代码还需要进一步优化:还请谅解~~:主要用到了threeJS创建mesh,创建平面,设置mesh的平移,旋转.缩放.自传.透明度.拉伸等这些小功能: 采 ...

  9. reactjs中使用threejs从0到1

    搭建本地开发环境 安装nodejs 按照 Create React App 安装指南创建一个新的项目 npx create-react-app react-three-demo 删除掉新项目中 src ...

随机推荐

  1. PostgreSQL常用函数

    1.系统信息函数 1.会话信息函数 edbstore=# select current_catalog; #查询当前数据库名称 current_database ------------------ ...

  2. Git中的文件上传、修改、撤消修改和删除

     1.添加文件.提交文件 1.1在learngit目录下创建一个readme.txt文件,并且输入内容. 1.2添加文件到版本库learngit 1.2.1使用git add 文件告诉Git把文件添加 ...

  3. HDFS - Shell命令

    HDFS - Shell命令 最近学习比较忙,本来想做一个搭建集群笔记,今天先记录HDFS-shell命令,明天,最迟明天下午我一定会做一个搭建集群的笔记.. 介绍一个我的集群搭建:一主三从 3个虚拟 ...

  4. Oracle11g版本中未归档隐藏参数

    In this post, I will give a list of all undocumented parameters in Oracle 11g. Here is a query to se ...

  5. vue+vue-resource+vue-cookie随笔

    vue-resource http拦截器interceptors: Vue.http.interceptors.push(function(request, next) {...} V-cookie: ...

  6. python3使用requests模块完成get/post/代理/自定义header/自定义Cookie

    一.背景说明 http请求的难易对一门语言来说是很重要的而且是越来越重要,但对于python一是urllib一些写法不太符合人的思维习惯文档也相当难看,二是在python2.x和python3.x中写 ...

  7. 服务器性能调优(netstat监控大量ESTABLISHED连接与Time_Wait连接问题)

    netstat监控大量ESTABLISHED连接与Time_Wait连接问题 问题描述: 在不考虑系统负载.CPU.内存等情况下,netstat监控大量ESTABLISHED连接与Time_Wait连 ...

  8. anglar cli的 rxjs_1.of is not a function

    按照官网敲例子遇到 rxjs_1.of is not a function import { Observable,of } from 'rxjs'; 改为 import { Observable} ...

  9. 逆袭之旅DAY20.XIA.程序调试

    2018-07-16 20:25:50 F5:进入方法 F6:单步执行

  10. js中 offset /client /scroll总结

    offset家族(只能读取,不能操作): offsetLeft:元素的边框的外边缘距离与已定位的父容器(offsetparent)的左边距离(就是子元素左边框到父元素左边框的距离). offsetTo ...