another try
This commit is contained in:
parent
55c21f3f49
commit
330f9050b7
2 changed files with 16 additions and 11 deletions
|
@ -75,14 +75,15 @@
|
|||
(animation/start-easing! e n (+ n 1) 1000 animation/linear #(infinite-easing e (+ n 1))))
|
||||
|
||||
(defn ease-view []
|
||||
(let [inf-ease (animation/easer 0.0)]
|
||||
(let [inf-ease (animation/easer 0.0)
|
||||
now (.getTime (js/Date.))]
|
||||
[: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 @inf-ease)])
|
||||
(rx [vgapi/view (gets [:vgapi]) now (rx @inf-ease)])
|
||||
]]
|
||||
[page 1 "subtitle" green "#title" "« Back to Title"
|
||||
[animated-title (gets [:subtitle])]]]
|
||||
|
|
|
@ -88,11 +88,12 @@
|
|||
;; ------------------------------------------------------------------------------
|
||||
;; View
|
||||
;; ------------------------------------------------------------------------------
|
||||
(defn view-tweets [state e]
|
||||
(defn view-tweets [state now e]
|
||||
(when (:messages state)
|
||||
(let [tweets (:messages state)
|
||||
max-sec (reduce max 0 (map :pub_date_epoch_ms tweets))
|
||||
(let [from (- now (* 50 1000))
|
||||
tweets (:messages state)
|
||||
tweets-by-sec (clojure.set/index (set tweets) [:pub_date_epoch_ms])
|
||||
nb-seconds (count (keys tweets-by-sec))
|
||||
max-nb (reduce #(max %1 (count %2)) 0 (vals tweets-by-sec))
|
||||
vh-height (/ 40 max-nb)
|
||||
tw-width (* 5 vh-height)
|
||||
|
@ -104,15 +105,18 @@
|
|||
:height "50vh"
|
||||
:border "solid 1px red"
|
||||
:font-family "Futura, sans-serif"}}
|
||||
(rx e)
|
||||
e [:br]
|
||||
(inc (rx e)) [:br]
|
||||
(for [tweet-sec (keys tweets-by-sec)]
|
||||
(let [nb (/ (- max-sec (:pub_date_epoch_ms tweet-sec)) 1000)]
|
||||
[:div {:style {:position "absolute"
|
||||
(let [decalage (/ (- (:pub_date_epoch_ms tweet-sec) e from) 1000)]
|
||||
(rx [:div (rx decalage)])
|
||||
#_[:div {:style {:position "absolute"
|
||||
:bottom "0"
|
||||
:left (rx (str (* (- e nb) tw-width) "vh"))
|
||||
:left (rx (str (- (* decalage tw-width)) "vh"))
|
||||
:width (str tw-width "vh")
|
||||
}
|
||||
}
|
||||
(str "e:" (rx @e) ", decalage:" decalage)
|
||||
(for [tweet (get tweets-by-sec tweet-sec)]
|
||||
[message tweet vh-height ])
|
||||
|
||||
|
@ -124,6 +128,6 @@
|
|||
[:div
|
||||
(str "volume: " (:volume state))])
|
||||
|
||||
(defn view [state e]
|
||||
(defn view [state now e]
|
||||
[:div
|
||||
[view-tweets state e]])
|
||||
[view-tweets state now e]])
|
||||
|
|
Loading…
Reference in a new issue