From ffb9fd2167926eec3f46ec7234684ead2e9bff0f Mon Sep 17 00:00:00 2001 From: Yann Esposito Date: Thu, 27 Aug 2015 17:20:09 +0200 Subject: [PATCH] working and playing --- src/apintro/core.cljs | 83 +++++++++++++++++++++--------------------- src/apintro/vgapi.cljs | 3 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/apintro/core.cljs b/src/apintro/core.cljs index 3ae80c1..2096d0d 100644 --- a/src/apintro/core.cljs +++ b/src/apintro/core.cljs @@ -12,10 +12,11 @@ (enable-console-print!) ;; INIT (init! {:title "I'm the Title" - :vgapi "xxx" ; (vgapi/initial-state) + :subtitle "Atom Sub Title" + :vgapi vgapi/initial-state }) -; (vgapi/init) +(vgapi/init) (defn on-js-reload [] ;; optionally touch your app-state to force rerendering depending on @@ -26,13 +27,13 @@ ) (def ease1 (animation/easer 0.0)) -(def ease2 (animation/easer 1.0)) -(def ease3 (animation/easer 2.0)) +(def ease2 (animation/easer 0.3)) +(def ease3 (animation/easer 0.0)) (def complex-transition (animation/easing-chain - [[ease1 0.5 1.0 1000 animation/linear] - [ease2 1.0 2.0 1000 animation/linear] + [[ease1 0.5 1.0 200 animation/linear] + [ease2 0.3 1.0 300 animation/linear] ])) (def orange "#E67E22") @@ -44,43 +45,43 @@ :top (str (+ 90 (* 100 n)) "%") :left 0}} title]) +(defn animated-title [text] + [:h1 {:style + {:font-size (rx (str (* 80 @ease1) "px")) + :padding-top (rx (str (* 200 @ease1) "px")) + :opacity (rx (str @ease2)) + :transform (rx (str "rotate(" @ease3 "deg)")) + :-webkit-transform (rx (str "rotate(" @ease3 "deg)")) + :-ms-transform (rx (str "rotate(" @ease3 "deg)")) + :text-align "center" + :text-shadow (str "1px 3px 0 rgba(0,0,0,0.1)") + :line-height "2em" + :color "rgba(255,255,255,0.9)" + } + :node/on-attached (fn [node callback] + (animation/start-easing! ease1 0 1.0 1000 animation/linear callback) + (animation/start-easing! ease2 0.3 1.0 1000 animation/linear callback) + (animation/start-easing! ease3 0.0 (* 3 360) 1000 animation/quad-out callback) + ; (complex-transition) + ) + } + text]) + +(defn page [i id color next-id next-text content] + [:div {:id id :style {:height "100vh" :background color :padding 0}} + content + [anchor i next-id next-text]]) + (defn ease-view [] [:div - [:div#title {:style {:height "100vh" - :background orange - :padding 0}} - - [:h1 {:style - {:font-size (rx (str (* 80 @ease1) "px")) - :margin 0 - :text-align "center" - :text-shadow (str "1px 3px 0 rgba(0,0,0,0.1)") - :line-height "2em" - :color "rgba(255,255,255,0.9)" - } - :node/on-attached (fn [x] (complex-transition)) - ; :on-click (fn [x] (sets [:title] "Clicked!")) - } - (gets [:title]) - ; "Title" - ] - [anchor 0 "#subtitle" "Go to Sub Title »"]] - [:div#subtitle {:style {:height "100vh" - :background green - :padding 0}} - - [:h2 {:style - {:font-size (rx (str (* 80 @ease1) "px")) - :margin 0 - :text-align "center" - :text-shadow (str "1px 3px 0 rgba(0,0,0,0.1)") - :line-height "2em" - :color "rgba(255,255,255,0.9)" - } - :node/on-attached (fn [x] (complex-transition)) - } - "Sub Title"] - [anchor 1 "#title" "« Back to Title"]]]) + [page 0 "title" orange "#subtitle" "To Sub Title »" + [:div + [animated-title (gets [:title])] + [:div.project {:style {:font-family "Monaco,monospace" :opacity 0.5}} + (gets [:vgapi :project-id])]]] + [page 1 "subtitle" green "#title" "« Back to Title" + [animated-title (gets [:subtitle])]] + ]) (defn view [] [:div diff --git a/src/apintro/vgapi.cljs b/src/apintro/vgapi.cljs index 5cdf4c0..5ee7af6 100644 --- a/src/apintro/vgapi.cljs +++ b/src/apintro/vgapi.cljs @@ -13,7 +13,6 @@ {:color 0 :angle 0 :volume 1 - ;; :project-id "vgteam-star_wars" :project-id "vigiglobe-Microsoft" :msg "Nothing done yet."}) @@ -31,7 +30,7 @@ from (.toISOString (new js/Date (- now (+ interval (* 60 1000))))) to (.toISOString (new js/Date (- now (* 60 1000)))) response (