Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var scene = new THREE.Scene();
- var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight , 0.1, 1000 );
- var renderer = new THREE.WebGLRenderer();
- renderer.setSize( window.innerWidth/1.7, (window.innerHeight/1.7) );
- document.body.appendChild( renderer.domElement );
- var geometry = new THREE.CubeGeometry(1,1,1);
- var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
- var cube = new THREE.Mesh( geometry, material );
- scene.add( cube );
- var geometry2 = new THREE.CubeGeometry(2,2,2);
- var material2 = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
- var cube2 = new THREE.Mesh( geometry2, material2 );
- cube2.position.z = -3;
- scene.add(cube2);
- var geometry3 = new THREE.CubeGeometry(4,4,4);
- var material3 = new THREE.MeshBasicMaterial( { color: 0x0000ff } );
- var cube3 = new THREE.Mesh( geometry3, material3 );
- cube3.position.z = -10;
- scene.add(cube3);
- camera.position.z = 5;
- function render() {
- requestAnimationFrame(render);
- cube.rotation.x += 0.01;
- cube.rotation.y += 0.01;
- cube2.rotation.x += 0.03;
- cube2.rotation.y += 0.03;
- cube3.rotation.x += 0.05;
- cube3.rotation.y += 0.05;
- renderer.render(scene, camera);
- }
- render();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement