adding camera panning. nice.

This commit is contained in:
2015-02-19 11:24:32 -08:00
parent dfdfcd7914
commit e517fffbd4
6 changed files with 179 additions and 116 deletions

View File

@@ -125,20 +125,7 @@
(defn make-music [r]
(doto (music r) (music! :set-looping true)))
(defn tween [id screen path start end duration & {:keys [finish power]}]
(let [power (or power 1.0)
finish (or finish identity)
start-time (or (:total-time screen) 0.0)
delta (- end start)]
(fn [e total-time]
(let [delta-time (- total-time start-time)
pct-done (min (/ delta-time duration) 1.0)
pct-done (Math/pow pct-done power)
e (assoc-in e path (+ start (* pct-done delta)))]
(if (= 1.0 pct-done)
(update-in (finish e) [:tweens] dissoc id)
e)
))))
(defn apply-tweens [screen entities tweens]
(reduce (fn [e f]