Skip to content

Instantly share code, notes, and snippets.

@aamedina
Created June 17, 2013 14:21
Show Gist options
  • Save aamedina/5797245 to your computer and use it in GitHub Desktop.
Save aamedina/5797245 to your computer and use it in GitHub Desktop.
(extend-type Renderer
IRenderable
(setup [this options]
(let [{:keys [width height]} options]
(doto this
(.setSize width height))))
(render [this renderables]
(.render this (first renderables) (second renderables)))
IAnimatable
(animate [this scene camera animatables]
(let [-animate
(fn -animate []
(.requestAnimationFrame js/window -animate)
(doseq [animatable animatables]
(animate! (:animatable animatable) (:animation animatable)))
(.render this scene camera))]
(-animate))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment