three.js 官网 https://threejs.org
three.js Github https://github.com/mrdoob/three.js
three.js Book https://github.com/Ovilia/ThreeExample.js
three.js Git
git clone https://github.com/mrdoob/three.js.git --depth 1
git clone https://github.com/d3/d3.git
// 只克隆最近一次commit
git clone git://URL --depth 1
// depth后,拉取全部历史
git pull --unshallow
three.js用法
<script src="js/three.min.js"></script>
<script>
var camera, scene, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
camera.position.z = 1;
scene = new THREE.Scene();
geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
</script>
three.js案例
- Physijs物理引擎 https://github.com/chandlerprall/Physijs