Skip to content

Instantly share code, notes, and snippets.

@jonathanhudak
Created August 16, 2014 17:56
Show Gist options
  • Save jonathanhudak/c573b31f5d8625a83802 to your computer and use it in GitHub Desktop.
Save jonathanhudak/c573b31f5d8625a83802 to your computer and use it in GitHub Desktop.
A Pen by Jonathan Hudak.
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()
body
margin 0
padding 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment