try
This commit is contained in:
parent
f81cfd763c
commit
55c21f3f49
2 changed files with 24 additions and 22 deletions
|
@ -71,17 +71,23 @@
|
|||
content
|
||||
[anchor i next-id next-text]])
|
||||
|
||||
(defn infinite-easing [e n]
|
||||
(animation/start-easing! e n (+ n 1) 1000 animation/linear #(infinite-easing e (+ n 1))))
|
||||
|
||||
(defn ease-view []
|
||||
[:div
|
||||
(let [inf-ease (animation/easer 0.0)]
|
||||
[:div {:node/on-attached (fn [a b] (infinite-easing inf-ease 0)) }
|
||||
[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])]
|
||||
(rx [vgapi/view (gets [:vgapi])])
|
||||
(rx [vgapi/view (gets [:vgapi]) (rx @inf-ease)])
|
||||
]]
|
||||
[page 1 "subtitle" green "#title" "« Back to Title"
|
||||
[animated-title (gets [:subtitle])]]])
|
||||
[animated-title (gets [:subtitle])]]]
|
||||
)
|
||||
)
|
||||
|
||||
(dom/mount! (.getElementById js/document "root") (ease-view))
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
(smart-si
|
||||
(fn []
|
||||
(go (let [now (.getTime (new js/Date))
|
||||
from (.toISOString (new js/Date (- now (+ (* 2 interval) (* 40 1000)))))
|
||||
from (.toISOString (new js/Date (- now (+ interval (* 40 1000)))))
|
||||
to (.toISOString (new js/Date (- now (* 40 1000))))
|
||||
response (<! (http/get (str "http://dev.api.vigiglo.be/api" route)
|
||||
{:query-params (into {:project_id (gets [prefix :project-id])
|
||||
|
@ -88,10 +88,9 @@
|
|||
;; ------------------------------------------------------------------------------
|
||||
;; View
|
||||
;; ------------------------------------------------------------------------------
|
||||
(defn view-tweets [state]
|
||||
(defn view-tweets [state e]
|
||||
(when (:messages state)
|
||||
(let [ease (animation/easer 1.0)
|
||||
tweets (:messages state)
|
||||
(let [tweets (:messages state)
|
||||
max-sec (reduce max 0 (map :pub_date_epoch_ms tweets))
|
||||
tweets-by-sec (clojure.set/index (set tweets) [:pub_date_epoch_ms])
|
||||
max-nb (reduce #(max %1 (count %2)) 0 (vals tweets-by-sec))
|
||||
|
@ -104,15 +103,13 @@
|
|||
:overflow "hidden"
|
||||
:height "50vh"
|
||||
:border "solid 1px red"
|
||||
:font-family "Futura, sans-serif"}
|
||||
:node/on-attached (fn [node callback]
|
||||
(animation/start-easing! ease 1.0 0.0 20000 animation/linear callback))
|
||||
}
|
||||
:font-family "Futura, sans-serif"}}
|
||||
(rx e)
|
||||
(for [tweet-sec (keys tweets-by-sec)]
|
||||
(let [nb (/ (- max-sec (:pub_date_epoch_ms tweet-sec)) 1000)]
|
||||
[:div {:style {:position "absolute"
|
||||
:bottom "0"
|
||||
:left (rx (str (* (- (* 10 @ease) nb) tw-width) "vh"))
|
||||
:left (rx (str (* (- e nb) tw-width) "vh"))
|
||||
:width (str tw-width "vh")
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +124,6 @@
|
|||
[:div
|
||||
(str "volume: " (:volume state))])
|
||||
|
||||
(defn view [state]
|
||||
(defn view [state e]
|
||||
[:div
|
||||
[view-volume state]
|
||||
[view-tweets state]])
|
||||
[view-tweets state e]])
|
||||
|
|
Loading…
Reference in a new issue