 ;; Timing
 ;;--------------------------------------------------------------------------------
 
-(def tick-chan (chan))
-(def tick-tap (mult tick-chan))
-(def prev-time nil)
+(def tick-chan
+  "This channel receives dt (delta time from last frame) in milliseconds."
+  (chan))
+
+(def tick-tap
+  "Allows anything to tap the tick channel (e.g. for animation)."
+  (mult tick-chan))
+
+(def prev-time
+  "Timestamp of the last tick."
+  nil)
 
 (defn tick!
+  "Creates heartbeat by hooking requestAnimationFrame to tick-chan."
   [curr-time]
   (draw!)
   (let [delta-ms (if prev-time

  (go
    (<! (multi-animate!
          [{:a 0 :b 1 :duration 1}
           {:a 900 :b 0 :duration 1}]
          [#(swap! state assoc-in [:js-face :alpha] %)
           #(swap! state assoc-in [:js-face :x] %)]))))

;;--------------------------------------------------------------------------------

;;--------------------------------------------------------------------------------

(def tweens
  "In-betweening animation functions."
  {:linear identity
   :swing #(- 0.5 (/ (cos (* % PI)) 2)) ;; from jquery

