A Pen by Jonathan Hudak on CodePen.
Created
August 16, 2014 17:56
-
-
Save jonathanhudak/c573b31f5d8625a83802 to your computer and use it in GitHub Desktop.
A Pen by Jonathan Hudak.
This file contains 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
#scene |
This file contains 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
init = -> | |
@scene = new THREE.Scene() | |
@renderer = new THREE.WebGLRenderer | |
antialias : true | |
preserveDrawingBuffer : true | |
@renderer.setSize window.innerWidth, window.innerHeight | |
@camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 10000 ) | |
@camera.position.set(0, 0, 5) | |
@scene.add @camera | |
geometry = new THREE.PlaneGeometry(3, 3) | |
grass = THREE.ImageUtils.loadTexture("http://www.mulchx-press.com/wp-content/uploads/2014/05/green-grass.jpg") | |
material = new THREE.MeshBasicMaterial | |
color: 0xffff00 | |
side: THREE.DoubleSide | |
map: grass | |
plane = new THREE.Mesh(geometry, material) | |
@scene.add plane | |
light = new THREE.AmbientLight( Math.random() * 0xffffff ) | |
@scene.add light | |
# THREEx.WindowResize.bind(renderer, camera) | |
document.getElementById('scene').appendChild(renderer.domElement) | |
animate = -> | |
requestAnimationFrame animate | |
render() | |
render = -> | |
PIseconds = Date.now() * Math.PI | |
# cameraControls.update() | |
@renderer.render( @scene, @camera ) | |
init() | |
animate() |
This file contains 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 | |
margin 0 | |
padding 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment