D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
1wheel
Full window
Github gist
threejs-cube
http://threejs.org/docs/#Manual/Introduction/Creating_a_scene
<!DOCTYPE html> <html> <head> <meta charset=utf-8> <title>My first Three.js app</title> <style> body { margin: 0; } canvas { width: 100%; height: 100% } </style> </head> <body> <script src="three.min.js"></script> <script> 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.BoxGeometry( 1, 1, 1 ); var material = new THREE.MeshBasicMaterial( { color: 'white', wireframe: true } ); var cube = new THREE.Mesh( geometry, material ); scene.add( cube ); camera.position.z = 5; var xVel = 0 var yVel = 0 function render() { requestAnimationFrame( render ); renderer.render( scene, camera ); xVel = Math.max(-2, Math.min(.2, xVel + (Math.random() - .5)/100)) yVel = Math.max(-2, Math.min(.2, yVel + (Math.random() - .5)/100)) cube.rotation.x += xVel; cube.rotation.y += yVel; } render(); </script> </body> </html>