step in the direction of having a rotating pack.
This commit is contained in:
@@ -1539,17 +1539,18 @@
|
|||||||
(let [fade-tween (if (= :hide hide-or-show)
|
(let [fade-tween (if (= :hide hide-or-show)
|
||||||
(tween/tween :appear-item screen [:selected-item :opacity] 1.0 0.0 0.5 :ease tween/ease-linear)
|
(tween/tween :appear-item screen [:selected-item :opacity] 1.0 0.0 0.5 :ease tween/ease-linear)
|
||||||
(tween/tween :appear-item screen [:selected-item :opacity] 0.0 1.0 0.5 :ease tween/ease-linear))
|
(tween/tween :appear-item screen [:selected-item :opacity] 0.0 1.0 0.5 :ease tween/ease-linear))
|
||||||
|
|
||||||
move-tween (condp = in-or-out
|
move-tween (condp = in-or-out
|
||||||
:far-out
|
:far-out
|
||||||
(tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear)
|
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 50) 0.5 :ease tween/ease-linear)
|
||||||
:out
|
:out
|
||||||
(tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 30) (* utils/ui-scale 35) 0.5 :ease tween/ease-linear)
|
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 40) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear)
|
||||||
|
|
||||||
:in
|
:in
|
||||||
(tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 30) 0.5 :ease tween/ease-linear)
|
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear)
|
||||||
|
|
||||||
:none
|
:none
|
||||||
(tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 35) 0.5 :ease tween/ease-linear))]
|
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear))]
|
||||||
(-> entities
|
(-> entities
|
||||||
(assoc :selected-item
|
(assoc :selected-item
|
||||||
(assoc (texture (aget (get-in entities [:all-items]) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
|
(assoc (texture (aget (get-in entities [:all-items]) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
|
||||||
@@ -1557,8 +1558,7 @@
|
|||||||
:origin-y 0
|
:origin-y 0
|
||||||
:scale-x utils/ui-scale
|
:scale-x utils/ui-scale
|
||||||
:scale-y utils/ui-scale
|
:scale-y utils/ui-scale
|
||||||
:x (- 320 (* utils/ui-scale 12))
|
:x (* utils/ui-scale (condp = in-or-out
|
||||||
:y (* utils/ui-scale (condp = in-or-out
|
|
||||||
:in
|
:in
|
||||||
35
|
35
|
||||||
:out
|
:out
|
||||||
@@ -1566,9 +1566,11 @@
|
|||||||
:none
|
:none
|
||||||
35
|
35
|
||||||
:far-out
|
:far-out
|
||||||
35)) :baseline 9000 :opacity (if (= :hide hide-or-show) 1.0 0.0)
|
35))
|
||||||
|
:y (* utils/ui-scale 0) :baseline 9000 :opacity (if (= :hide hide-or-show) 1.0 0.0)
|
||||||
:item item))
|
:item item))
|
||||||
(assoc-in [:tweens :appear-item] fade-tween)
|
(assoc-in [:tweens :appear-item] fade-tween)
|
||||||
|
|
||||||
(assoc-in [:tweens :appear-item-y] move-tween))))
|
(assoc-in [:tweens :appear-item-y] move-tween))))
|
||||||
(transition-done? [this screen entities]
|
(transition-done? [this screen entities]
|
||||||
(not (get-in entities [:tweens :appear-item])))))
|
(not (get-in entities [:tweens :appear-item])))))
|
||||||
@@ -1578,7 +1580,14 @@
|
|||||||
(accept-state entities state state-data
|
(accept-state entities state state-data
|
||||||
[(reify ITransition
|
[(reify ITransition
|
||||||
(start-transition [this screen entities]
|
(start-transition [this screen entities]
|
||||||
(update-in entities [:inventory] #(actions/start-animation screen % :open)))
|
(let [rotate-tween (tween/tween :rotate-pack screen [:inventory :angle] 0.0 -90.0 0.25 :ease tween/ease-linear)
|
||||||
|
y-tween (tween/tween :y-pack screen [:inventory :y] (* utils/ui-scale 21) (* utils/ui-scale 5) 0.25 :ease tween/ease-linear)
|
||||||
|
x-tween (tween/tween :x-pack screen [:inventory :x] (* utils/ui-scale 24) (* utils/ui-scale 15) 0.25 :ease tween/ease-linear)]
|
||||||
|
(-> entities
|
||||||
|
(assoc-in [:tweens :rotate-pack] rotate-tween)
|
||||||
|
(assoc-in [:tweens :y-pack] y-tween)
|
||||||
|
(assoc-in [:tweens :x-pack] x-tween)
|
||||||
|
(update-in [:inventory] #(actions/start-animation screen % :open)))))
|
||||||
(transition-done? [this screen entities]
|
(transition-done? [this screen entities]
|
||||||
(animation! (get-in entities [:inventory :anim])
|
(animation! (get-in entities [:inventory :anim])
|
||||||
:is-animation-finished
|
:is-animation-finished
|
||||||
@@ -1803,23 +1812,23 @@
|
|||||||
:width 16 :height 16
|
:width 16 :height 16
|
||||||
:baseline 9000
|
:baseline 9000
|
||||||
:opacity 0.8)
|
:opacity 0.8)
|
||||||
:inventory (assoc (utils/get-texture "inventory.png") :x (- 320 (* 21 utils/ui-scale)) :y (* 27 utils/ui-scale ) :baseline 9000
|
:inventory (assoc (utils/get-texture "inventory.png") :x (* 21 utils/ui-scale ) :y (* 27 utils/ui-scale ) :baseline 9000
|
||||||
:intersect-width 42 :intersect-height 48
|
:intersect-width 42 :intersect-height 48
|
||||||
:width 42 :height 56
|
:width 42 :height 56
|
||||||
:origin-x 21 :origin-y 27
|
:origin-x 21 :origin-y 27
|
||||||
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
||||||
:open (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
|
:open (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
|
||||||
(animation! :set-play-mode (play-mode :normal)))
|
(animation! :set-play-mode (play-mode :normal))))
|
||||||
:anim (utils/make-anim "inventory.png" [42 56] 0.1 [0])
|
:anim (utils/flip (utils/make-anim "inventory.png" [42 56] 0.1 [0]))
|
||||||
:anim-loop? false
|
:anim-loop? false
|
||||||
:default (utils/make-anim "inventory.png" [42 56] 0.1 [0])
|
:default (utils/flip (utils/make-anim "inventory.png" [42 56] 0.1 [0]))
|
||||||
:opened (utils/make-anim-seq "open-inventory" [42 56] 0.1 [7])
|
:opened (utils/flip (utils/make-anim-seq "open-inventory" [42 56] 0.1 [7]))
|
||||||
:closing (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 [7 7 7 7 7 7 7 9 10 11 12 0])
|
:closing (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 [7 7 7 7 7 7 7 9 10 11 12 0])
|
||||||
(animation! :set-play-mode (play-mode :normal)))
|
(animation! :set-play-mode (play-mode :normal))))
|
||||||
:anim-start 0
|
:anim-start 0
|
||||||
:opacity 0.8)
|
:opacity 0.8)
|
||||||
:all-items (texture! (texture (pixmap "cursor.png")) :split 18 16)
|
:all-items (texture! (texture (pixmap "cursor.png")) :split 18 16)
|
||||||
:fps (->> (assoc (label "" (color :white) ) :y 30 :x 5 :baseline 0 :opacity 0.1)
|
:fps (->> (assoc (label "" (color :white) ) :y 10 :x 280 :baseline 0 :opacity 0.1)
|
||||||
(utils/add-actor-to-stage screen))}))
|
(utils/add-actor-to-stage screen))}))
|
||||||
|
|
||||||
:on-render
|
:on-render
|
||||||
|
|||||||
Reference in New Issue
Block a user