slight optimization

This commit is contained in:
Yann Esposito 2015-09-02 16:06:01 +02:00
parent ecfd91d960
commit fc8f008e2d
3 changed files with 39 additions and 30 deletions

View file

@ -51,7 +51,9 @@
{:font-size (rx (str (* 10 @ease1) "vh"))
:padding-top (rx (str (* 10 @ease1) "vh"))
:opacity (rx (str @ease2))
:transform (rx (str "translateX(" (* 20 @ease3 (Math/sin (* 30 @ease3))) "px) rotate(" (* 5 (Math/sin (* 30 @ease3))) "deg)"))
:-webkit-transform (rx (str "translateX(" (* 20 @ease3 (Math/sin (* 30 @ease3))) "px) rotate(" (* 5 (Math/sin (* 30 @ease3))) "deg)"))
:-moz-transform (rx (str "translateX(" (* 20 @ease3 (Math/sin (* 30 @ease3))) "px) rotate(" (* 5 (Math/sin (* 30 @ease3))) "deg)"))
:text-align "center"
:text-shadow (str "1px 3px 0 rgba(0,0,0,0.1)")
:line-height "2em"
@ -88,7 +90,10 @@
(drop 1 (clojure.string/split (gets [:vgapi :project-id]) "-"))]
[:div
{:style {:opacity (rx (str @ease4))
:-webkit-filter (rx (str "blur(" (* 15 (- 1 @ease4)) "px)"))}
:-webkit-filter (rx (str "blur(" (* 15 (- 1 @ease4)) "px)"))
:-moz-filter (rx (str "blur(" (* 15 (- 1 @ease4)) "px)"))
:filter (rx (str "blur(" (* 15 (- 1 @ease4)) "px)"))
}
:node/on-attached (fn [node callback]
(animation/start-easing! ease4 0.0 1.0 7000 animation/quad-in callback))
}

View file

@ -157,8 +157,10 @@
}
:on-click #(open (tweet-url message))
}
[user-pic {:message message}]
; [user-name message params]
[text message]
; [actions-holder message params]
]))
(when (> height 2)
[:div
[user-pic {:message message}]
[user-name message params]
[text message]
[actions-holder message params]]
)]))

View file

@ -20,8 +20,8 @@
:msg "Nothing done yet."})
(def time-protection 10000)
(def time-period 10000)
(def time-period-margin 90000)
(def time-period 4000)
(def time-period-margin 15000)
;; ------------------------------------------------------------------------------
;; Tasks
@ -105,31 +105,33 @@
[:div {:style {:text-align "left"
:line-height "2em"
:position "relative"
:overflow "hidden"
:right (rx (str (* @e tw-width) "vh"))
:height "50vh"
:font-family "Verdana, sans-serif"}}
(for [tweet-sec (keys tweets-by-sec)]
[:div {:style {:position "absolute"
:bottom "0"
:right (rx
(str (- (* (- (/ (- (:pub_date_epoch_ms tweet-sec) (- time-period) from)
1000) @e ) tw-width)) "vh"))
:width (str tw-width "vh")
}
}
(for [tweet (get tweets-by-sec tweet-sec)]
[message tweet vh-height ])
(for [tweet-sec (sort-by :pub_date_epoch_ms (keys tweets-by-sec))]
(let [decalage (-
(/ (+ time-period
(- (:pub_date_epoch_ms tweet-sec)
from))
1000))]
[:div {:style {:position "absolute"
:bottom "0"
:right (str (* decalage tw-width) "vh")
:width (str tw-width "vh")
}
}
(for [tweet (get tweets-by-sec tweet-sec)]
[message tweet vh-height])
[:div {:style {:font-size ".5em"
:text-align "center"
:border 0
:padding 0
:margin 0
:line-height "1.5em"
:text-shadow "0 0 2px rgba(0,0,0,0.5)"
:width "100%"}} (clojure.string/replace (.toISOString (js/Date. (:pub_date_epoch_ms tweet-sec)))
#".*T(.*)\....Z" "$1")]
])])))
[:div {:style {:font-size ".5em"
:text-align "center"
:border 0
:padding 0
:margin 0
:line-height "1.5em"
:text-shadow "0 0 2px rgba(0,0,0,0.5)"
:width "100%"}} (clojure.string/replace (.toISOString (js/Date. (:pub_date_epoch_ms tweet-sec)))
#".*T(.*)\....Z" "$1")]]))])))
(defn view-volume [state]
[:div