Created
May 23, 2013 22:49
-
-
Save JeffCohen/5640081 to your computer and use it in GitHub Desktop.
JS shapes demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body></body> | |
<script src="http://gamingJS.com/Three.js"></script> | |
<script src="http://gamingJS.com/ChromeFixes.js"></script> | |
<script> | |
var camera, scene, renderer; | |
var geometry, material, mesh; | |
init(); | |
animate(); | |
function init() { | |
scene = new THREE.Scene(); | |
var aspect = window.innerWidth / window.innerHeight; | |
camera = new THREE.PerspectiveCamera(75, aspect, 1, 1000); | |
camera.position.z = 500; | |
scene.add(camera); | |
geometry = new THREE.IcosahedronGeometry(200, 1); | |
//geometry = new THREE.CylinderGeometry(100, 100, 20, 10); | |
material = new THREE.MeshBasicMaterial({ | |
color: 0x000000, | |
wireframe: true, | |
wireframeLinewidth: 2 | |
}); | |
mesh = new THREE.Mesh(geometry, material); | |
scene.add(mesh); | |
renderer = new THREE.CanvasRenderer(); | |
renderer.setClearColorHex(0xffffff); | |
renderer.setSize(window.innerWidth, window.innerHeight); | |
document.body.style.margin = 0; | |
document.body.style.overflow = 'hidden'; | |
document.body.appendChild(renderer.domElement); | |
renderer.render(scene, camera); | |
} | |
function animate() { | |
requestAnimationFrame(animate); | |
mesh.rotation.x = Date.now() * 0.0005; | |
mesh.rotation.y = Date.now() * 0.001; | |
renderer.render(scene, camera); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment