Firefox os関東勉強会20130719
- 16. three.jsのコードで表現
var aspect = window.innerWidth / window.innerHeight;
var camera = new THREE.PerspectiveCamera(90,aspect, 1,
1000);
camera.position.x = 0;
camera.position.z = 1;
camera.position.y = 1;
camera.up.x = 0;
camera.up.y = 1;
camera.up.z = 0;
- 19. three.jsのコードで表現
for ( var i = 0; i < 500; i ++ ) {
material = new THREE.MeshPhongMaterial(
{ specular: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors }
);
var size = Math.random() * 10.0 + 10.0;
geometry = new THREE.CubeGeometry( size, size, size );
var mesh = new THREE.Mesh( geometry, material );
mesh.position.x = Math.floor( Math.random() * 20 - 10 ) * 20;
mesh.position.y = Math.floor( Math.random() * 20 ) * 20 + 10;
mesh.position.z = Math.floor( Math.random() * 20 - 10 ) * 20;
scene.add( mesh );
material.color.setHSL( Math.random() * 1.0, 0.75, Math.random() * 0.25 +
objects.push( mesh );
}
1
2
3