Skip to content

Instantly share code, notes, and snippets.

@cdated
Created August 10, 2016 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdated/a2ad851e5316a89dba977029fcb03f30 to your computer and use it in GitHub Desktop.
Save cdated/a2ad851e5316a89dba977029fcb03f30 to your computer and use it in GitHub Desktop.
Full Loop
<body></body>
<script src="http://gamingJS.com/Three.js"></script>
<script src="http://gamingJS.com/ChromeFixes.js"></script>
<script>
// This is where stuff in our game will happen:
var scene = new THREE.Scene();
// This is what sees the stuff:
var aspect_ratio = window.innerWidth / window.innerHeight;
var camera = new THREE.PerspectiveCamera(75, aspect_ratio, 1, 10000);
camera.position.z = 500;
scene.add(camera);
// This will draw what the camera sees onto the screen:
var renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// ******** START CODING ON THE NEXT LINE ********
for (var i=0;i<20; i++) {
var cover = new THREE.MeshNormalMaterial();
var cylinder = new THREE.CylinderGeometry(125, 125, 125, 30);
var tube = new THREE.Mesh(cylinder, cover);
tube.position.set(-1000 + i*300, 0, -50);
scene.add(tube);
}
// Now, show what the camera sees on the screen:
renderer.render(scene, camera);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment