pop logo
This commit is contained in:
BIN
desktop/resources/music/POPPixelLogo2Audiomix_mixdown.ogg
Normal file
BIN
desktop/resources/music/POPPixelLogo2Audiomix_mixdown.ogg
Normal file
Binary file not shown.
@@ -25,13 +25,13 @@
|
||||
|
||||
(defn fade-in [screen e thing then]
|
||||
(assoc-in e [:tweens :fade-in]
|
||||
(tween/tween :fade-in screen [thing :opacity] 0.0 1.0 5.0
|
||||
(tween/tween :fade-in screen [thing :opacity] 0.0 1.0 1.0
|
||||
:finish then
|
||||
:ease tween/ease-in-quadratic)))
|
||||
|
||||
(defn fade-out [screen e thing then]
|
||||
(assoc-in e [:tweens :fade-out]
|
||||
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 5.0
|
||||
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 1.0
|
||||
:finish then
|
||||
:ease tween/ease-in-quadratic)))
|
||||
|
||||
@@ -49,6 +49,48 @@
|
||||
entity))
|
||||
|
||||
|
||||
(defn update-from-step [screen {:keys [current-step steps] :as entities}]
|
||||
(if current-step
|
||||
(if (>= (or (:total-time screen) 0.0) (+ (:duration current-step) (:started current-step)))
|
||||
(assoc entities :current-step nil)
|
||||
entities)
|
||||
|
||||
(let [[current-step & steps] steps]
|
||||
(if current-step
|
||||
(assoc ((:do current-step) screen entities)
|
||||
:current-step (assoc current-step
|
||||
:started (:total-time screen))
|
||||
:steps steps)
|
||||
entities))))
|
||||
|
||||
(def steps
|
||||
[{:can-skip false
|
||||
:do (fn [screen entities]
|
||||
(fade-in screen entities :dbhlogo identity))
|
||||
:duration 1.0}
|
||||
{:can-skip true
|
||||
:do (fn [screen entities]
|
||||
entities)
|
||||
:duration 2.0}
|
||||
{:can-skip false
|
||||
:do (fn [screen entities]
|
||||
(fade-out screen entities :dbhlogo identity))
|
||||
:duration 2.0}
|
||||
{:can-skip true
|
||||
:do (fn [screen entities]
|
||||
(utils/play-music (:pop-music entities))
|
||||
(-> entities
|
||||
(assoc-in [:pop-logo :anim-start] (:total-time screen))
|
||||
(assoc-in [:pop-logo :anim] (get-in entities [:pop-logo :main-anim]))))
|
||||
:duration 10.0}
|
||||
{:can-skip false
|
||||
:do (fn [screen entities]
|
||||
(utils/stop-music (:pop-music entities))
|
||||
(set-screen! @(resolve 'advent.core/advent) title/title-screen)
|
||||
entities)
|
||||
:duration 0.0}])
|
||||
|
||||
|
||||
(defscreen splash-screen
|
||||
:on-show
|
||||
(fn [screen entities]
|
||||
@@ -72,20 +114,11 @@
|
||||
:origin-x 0 :origin-y 0
|
||||
:scale-x 4 :scale-y 4
|
||||
:z 1)
|
||||
:dbhlogo (assoc (utils/get-texture "dbh.png") :x 0 :y 0 :origin-x 0 :origin-y 0 :z 1 :opacity 0.0)}]
|
||||
(fade-in screen entities :dbhlogo
|
||||
(fn [entities]
|
||||
(fade-out (assoc-in screen [:total-time] 5.0) entities :dbhlogo
|
||||
(fn [entities]
|
||||
(as-> entities entities
|
||||
(assoc-in entities [:pop-logo :anim-start ] 10.0)
|
||||
(assoc-in entities [:pop-logo :anim] (get-in entities [:pop-logo :main-anim]))
|
||||
(fade-in (assoc-in screen [:total-time] 10.0) entities :pop-logo
|
||||
(fn [entities]
|
||||
(fade-out (assoc-in screen [:total-time] 15.0) entities :pop-logo
|
||||
(fn [entities]
|
||||
(set-screen! @(resolve 'advent.core/advent) title/title-screen)
|
||||
entities)))))))))))
|
||||
:dbhlogo (assoc (utils/get-texture "dbh.png") :x 0 :y 0 :origin-x 0 :origin-y 0 :z 1 :opacity 0.0)
|
||||
:steps steps
|
||||
:pop-music (utils/make-music "music/POPPixelLogo2Audiomix_mixdown.ogg")
|
||||
:current-step nil}]
|
||||
entities))
|
||||
|
||||
|
||||
:on-render
|
||||
@@ -94,12 +127,21 @@
|
||||
(.apply viewport)
|
||||
(clear!)
|
||||
(let [entities (utils/apply-tweens screen entities (:tweens entities))
|
||||
entities (update-in entities [:pop-logo] animate screen)]
|
||||
entities (update-in entities [:pop-logo] animate screen)
|
||||
entities (if (and (:queued-skip? entities) (get-in entities [:current-step :can-skip]))
|
||||
(assoc entities :queued-skip? false :current-step nil)
|
||||
entities)
|
||||
entities (update-from-step screen entities)]
|
||||
(render! screen (sort-by :z (filter :object (vals entities))) )
|
||||
entities))
|
||||
|
||||
:show-screen (fn [entities]
|
||||
entities)
|
||||
|
||||
:on-touch-up (fn [screen [entities]]
|
||||
(if (get-in entities [:current-step :can-skip])
|
||||
(assoc entities :current-step nil :queued-skip? false)
|
||||
(assoc entities :queued-skip? true)))
|
||||
|
||||
:on-key-up
|
||||
(fn [screen entities]
|
||||
|
||||
Reference in New Issue
Block a user