aboutsummaryrefslogtreecommitdiffstats
path: root/src/animation/Animator.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/animation/Animator.js')
-rw-r--r--src/animation/Animator.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/animation/Animator.js b/src/animation/Animator.js
index cac0eb9..2786602 100644
--- a/src/animation/Animator.js
+++ b/src/animation/Animator.js
@@ -5,7 +5,7 @@ const Animator = {
nextDraw: null,
frames: new Queue(),
timeouts: new Queue(),
- timer: globals.window.performance || globals.window.Date,
+ timer: () => globals.window.performance || globals.window.Date,
transforms: [],
frame (fn) {
@@ -29,7 +29,7 @@ const Animator = {
delay = delay || 0
// Work out when the event should fire
- var time = Animator.timer.now() + delay
+ var time = Animator.timer().now() + delay
// Add the timeout to the end of the queue
var node = Animator.timeouts.push({ run: fn, time: time })
@@ -43,11 +43,11 @@ const Animator = {
},
cancelFrame (node) {
- Animator.frames.remove(node)
+ node != null && Animator.frames.remove(node)
},
clearTimeout (node) {
- Animator.timeouts.remove(node)
+ node != null && Animator.timeouts.remove(node)
},
_draw (now) {