          :loop loop
          :speed speed}))
 
+(defn elapsed-time-since [then]
+  (/ (- (.getTime (js/Date.)) (.getTime then)) 1000))
+
 (defn apply-diff [state {:keys [lines cursor]}]
   (merge-with merge state {:lines lines :cursor cursor}))
 

  (let [start (js/Date.)
        play-from (:play-from state)
        speed (:speed state)
        frames (-> (:frames state) (next-frames play-from) (frames-at-speed speed))
        diff-chan (coll->chan frames)
        timer-chan (coll->chan (repeat [0.3 true]))
        stop-playback-chan (chan)
        elapsed-time #(* (elapsed-time-since start) speed)

          (cons [(- delay seconds) diff] (rest frames))))
      frames)))

(defn reset-blink [state]
  (assoc-in state [:cursor :on] true))

