Add '12/torusKnot.js'

master
ioanatomici 5 years ago
parent 0be40c7acf
commit 2579c80f81

@ -0,0 +1,25 @@
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, window.innerHeight );
document.body.appendChild( renderer.domElement );
var geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 );
var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
var torusKnot = new THREE.Mesh( geometry, material );
scene.add( torusKnot );
camera.position.z = 20;
var animate = function () {
requestAnimationFrame( animate );
torusKnot.rotation.x += 0.01;
torusKnot.rotation.y += 0.01;
renderer.render( scene, camera );
};
animate();
Loading…
Cancel
Save