working and playing

This commit is contained in:
Yann Esposito 2015-08-27 17:20:09 +02:00
parent d1f110f706
commit ffb9fd2167
2 changed files with 43 additions and 43 deletions

View file

@ -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

View file

@ -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 (<! (http/get (str "http://dev.api.vigiglo.be/api" route)
{:query-params (into {:project_id (gets :project-id)
{:query-params (into {:project_id (gets [:vgapi :project-id])
:timeFrom from
:timeTo to}
params)}))]