update request-animation-frame, refactor raf-start-time as local binding
This commit is contained in:
parent
5f00b1c9d9
commit
d6d20eaa97
1 changed files with 5 additions and 6 deletions
|
@ -171,8 +171,6 @@
|
|||
|
||||
;; ## Polyfills
|
||||
|
||||
(def ^:private raf-start-time (.getTime (js/Date.)))
|
||||
|
||||
(def request-animation-frame
|
||||
(or
|
||||
(.-requestAnimationFrame js/window)
|
||||
|
@ -180,10 +178,11 @@
|
|||
(.-mozRequestAnimationFrame js/window)
|
||||
(.-msRequestAnimationFrame js/window)
|
||||
(.-oRequestAnimationFrame js/window)
|
||||
(fn [f]
|
||||
(js/setTimeout
|
||||
#(f (- (.getTime (js/Date.)) raf-start-time))
|
||||
16.66666))))
|
||||
(let [t0 (.getTime (js/Date.))]
|
||||
(fn [f]
|
||||
(js/setTimeout
|
||||
#(f (- (.getTime (js/Date.)) t0))
|
||||
16.66666)))))
|
||||
|
||||
;; Render Loop
|
||||
|
||||
|
|
Loading…
Reference in a new issue