Permalink
Browse files

Add animationloop settings

  • Loading branch information...
koenbok committed Oct 18, 2014
1 parent d89500c commit db9ffd11500b18b71aa375481329df71e750f244
Showing with 14 additions and 4 deletions.
  1. +14 −4 framer/AnimationLoop.coffee
@@ -8,11 +8,18 @@ if window.performance
else
getTime = -> Date.now()
# Make the time ticks a "fixed" 1/60 of a second.
# Framer.Loop.delta = 1/60
# Include workaround for a WebKit2 browser bug
# Framer.Loop.raf = false
class exports.AnimationLoop extends EventEmitter
constructor: ->
@fps = 60
@delta = null
@raf = true
# Workaraound for RAF bug on 10.10
@@ -31,9 +38,12 @@ class exports.AnimationLoop extends EventEmitter
update = ->
timestamp = getTime()
delta = (timestamp - _timestamp) / 1000
_timestamp = timestamp
if animationLoop.delta
delta = animationLoop.delta
else
timestamp = getTime()
delta = (timestamp - _timestamp) / 1000
_timestamp = timestamp
animationLoop.emit("update", delta)
animationLoop.emit("render", delta)

0 comments on commit db9ffd1

Please sign in to comment.