virvar b484edf36c Replace animation listeners to callbacks. Handle height < 0.
Former-commit-id: 72bdf34348a164f2b77400f7f0e77e3ba594451e
2016-06-03 14:46:32 +03:00

46 lines
1.0 KiB
Clojure

(ns status-im.components.animation
(:require [status-im.components.react :refer [animated]]))
(defn start
([anim] (.start anim))
([anim callback] (.start anim callback)))
(defn timing [anim-value config]
(.timing animated anim-value (clj->js config)))
(defn spring [anim-value config]
(.spring animated anim-value (clj->js config)))
(defn event [config]
(.event animated (clj->js [nil, config])))
(defn add-listener [anim-value listener]
(.addListener anim-value listener))
(defn remove-all-listeners [anim-value]
(.removeAllListeners anim-value))
(defn stop-animation [anim-value]
(.stopAnimation anim-value))
(defn value [anim-value]
(.-value anim-value))
(defn set-value [anim-value value]
(.setValue anim-value value))
(defn create-value [value]
(js/React.Animated.Value. value))
(defn x [value-xy]
(.-x value-xy))
(defn y [value-xy]
(.-y value-xy))
(defn get-layout [value-xy]
(js->clj (.getLayout value-xy)))
(defn create-value-xy [x y]
(js/React.Animated.ValueXY. (clj->js {:x x, :y y})))