reanimated.core
An animation library for Reagent (ClojureScript).
There is only one concept:
A reaction that moves toward some target,
each step triggers another update until it reaches the end state.
The trigger occurs by touching a local atom a zero timeout,
which changes the atom in the next Reagent render.
interpolate-arg
(interpolate-arg component x)
(interpolate-arg component x options)
Interpolates the argument of a component to x.
Will call the given component with values approaching x.
Options can contain duration (in milliseconds)
and easing (a function of a b duration t).
interpolate-if
(interpolate-if condition a b)
(interpolate-if condition a b options)
Interpolates between two values when the conditon changes.
Takes a condition ratom to watch, and 2 vectors or values to render.
Options can contain duration (in milliseconds)
and easing (a function of a b duration t).
interpolate-to
(interpolate-to x)
(interpolate-to x options)
Interpolates toward new values.
Takes a ratom which stores a numeric value.
Options can contain duration (in milliseconds)
and easing (a function of a b duration t).
interval
(interval f t)
Call function f every period t while mounted in the DOM.
mouse-watcher
(mouse-watcher ratom)
Returns a map suitable for merging with component properties,
that will keep a given ratom updated with the mouseover status.
pop-when
(pop-when condition then)
(pop-when condition then options)
Wraps a component to animate creation and destruction.
Takes a condition ratom and a vector or value to be rendered.
Options can contain duration (milliseconds)
and easing (a function that takes a b duration t).
slow-reveal
(slow-reveal t xs)
spring
(spring x2)
(spring x2 options)
Useful for wrapping a value in your component to make it springy.
Returns a reaction that will take values approaching x2,
updating every time Reagent calls requestAnimationFrame.
Integrates a physical spring simulation for each step.
Options can contain:
from - a value to start from (initial value is used if absent).
velocity of the mass on the spring (initially 0 if absent).
mass, stiffness, damping of the spring.
timeline
(timeline x & xs)
Given a sequence of inputs, will consume them depending on their type:
numbers will be a sleep in milliseconds
functions will be called with no arguments
vectors will be rendered as reagent components.
timeout
(timeout f t)
Call function f period t in milliseconds after being mounted in the DOM,
only if still mounted.
toggle-handler
(toggle-handler ratom)
Creates an event handler that will toggle a given ratom.
watch
(watch r f)
Watch a ref only while mounted in the DOM.