fixed fade jump, and fixed match in subtract

This commit is contained in:
Bryce Covert
2016-10-06 22:05:25 -07:00
parent 2a0d6bcb28
commit 55fd9495eb
5 changed files with 23 additions and 25 deletions

View File

@@ -5,7 +5,6 @@ sound duration on android
choosing interaction feels wrong - flies hard to touch
change hotspots as necessary
turn off desk hotspots if you don't have inventory
Fade out needs to start at 100 opacity
less common for gandarfs experiment
delay in update with label causes jumpiness

View File

@@ -25,7 +25,7 @@
:scale-y 100
:x -1
:y -1
:opacity 0.0
:opacity 1.0
:origin-x 0
:origin-y 0)})

View File

@@ -646,7 +646,7 @@
:else
(do (actions/play-animation entities :door :open)
(actions/transition-background entities :inside-house [237 0] :between (fn [s e]
(if (= 1 (rand-int 2))
(if (= 1 (rand-int 5))
(assoc-in e [:room :entities :experiment] (get-in e [:room :experiment]))
e)))
(when (get-in @entities [:room :entities :experiment])

View File

@@ -182,7 +182,6 @@ void main ()
maximum-x (- 320 margin-width)
label-width (label! l :get-width)
label-right (+ (:x l) (/ label-width 2))
_ (println label-right)
l (cond (> label-right maximum-x) (assoc l :x (- maximum-x label-width))
(< (:x l) minimum-x) (assoc l :x minimum-x)
:else l)]
@@ -984,15 +983,17 @@ void main ()
(if (not (get-in entities [:started? :value]))
(do (music! (utils/get-current-music entities) :set-volume (utils/current-music-volume (get-in entities [:volume :value])))
(utils/play-music (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))]))
(assoc entities
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic
:finish #(if (not (get-in % [:state :seen-intro?]))
(do ((actions/get-script % (rooms.dream/do-intro %)) entities)
%)
%))
:fade-in-music (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 1.0 :ease tween/ease-in-cubic)}
:started? {:value true
:object nil}))
(-> entities
(assoc
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic
:finish #(if (not (get-in % [:state :seen-intro?]))
(do ((actions/get-script % (rooms.dream/do-intro %)) entities)
%)
%))
:fade-in-music (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 1.0 :ease tween/ease-in-cubic)}
:started? {:value true
:object nil})
(assoc-in [:fade :opacity] 1.0)))
entities))
(defn play-sound-if-necessary [screen entities target {:keys [previous-frame-index current-frame-index anim-sound-frames anim x y] :as e :or {anim-sound-frames {}}}]
@@ -1907,14 +1908,12 @@ void main ()
:on-give-item
(fn [screen entities {:keys [item]}]
(doto
(-> entities
(update-in [:inv-fsm :pending-states] conj [:acquire item])
(update-in [:inv-fsm] (fn [{:keys [state state-data] :as fsm}]
(if (and (= state :selected) (= item state-data))
(update-in fsm [:pending-states] conj [:none state-data])
(update-in fsm [:pending-states] conj [:none state-data])))))
(#(println (get-in % [:inv-fsm :pending-states])))))
(-> entities
(update-in [:inv-fsm :pending-states] conj [:acquire item])
(update-in [:inv-fsm] (fn [{:keys [state state-data] :as fsm}]
(if (and (= state :selected) (= item state-data))
(update-in fsm [:pending-states] conj [:none state-data])
(update-in fsm [:pending-states] conj [:none state-data]))))))
:on-remove-item
(fn [screen entities {:keys [item]}]

View File

@@ -6,8 +6,8 @@
(fn ^double [^double t ^double start ^double delta ^double duration]
(let [pct-done (/ t duration)
pct-done (Math/pow pct-done power)]
(+ start
(* delta pct-done)))))
(+ start
(* delta pct-done)))))
(def ease-linear (ease-in-expo-maker 1.0))
(def ease-in-quadratic (ease-in-expo-maker 2.0))
@@ -42,9 +42,9 @@
(defn ease-out-quadratic ^double [^double t ^double start ^double delta ^double duration]
(let [t (/ t duration)]
(unchecked-add (-> (unchecked-subtract 1 delta)
(unchecked-add (-> (unchecked-subtract 0.0 delta)
(unchecked-multiply t)
(unchecked-multiply (unchecked-subtract t 2)))
(unchecked-multiply (unchecked-subtract t 2.0)))
start)))
(defn ease-out-cubic ^double [^double t ^double start ^double delta ^double duration]