You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
691 B
JavaScript
25 lines
691 B
JavaScript
5 years ago
|
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();
|