Module AnimatedRe-BsReactNative.Value

Standard value for driving animations. One Animated.Value can drive multiple properties in a synchronized fashion, but can only be driven by one mechanism at a time. Using a new mechanism (e.g. starting a new animation, or calling setValue) will stop any previous ones.

Typically initialized with Animated.Value.create(0.0);

See React Native documentation for additional details.

type t = value(regular);
type jsValue = Js.t({. value: float, });
type callback = jsValue => unit;
let create: float => t;

Creates new Animated value with a given initial value.

let setValue: t => float => unit;

Directly set the value. This will stop any animations running on the value and update all the bound properties.

let setOffset: t => float => unit;

Sets an offset that is applied on top of whatever value is set.

let flattenOffset: t => unit;

Merges the offset value into the base value and resets the offset to zero. The final output of the value is unchanged.

let extractOffset: t => unit;

Sets the offset value to the base value, and resets the base value to zero. The final output of the value is unchanged.

let addListener: t => callback => string;

Adds an asynchronous listener to the value so you can observe updates from animations. See React Native documentation for additional details.

let removeListener: t => string => unit;

Unregister a listener. The id param shall match the identifier previously returned by addListener.

let removeAllListeners: t => unit;

Remove all registered listeners.

let resetAnimation: t => ?⁠callback:callback => unit => unit;

Stops any animation and resets the value to its original.

let stopAnimation: t => ?⁠callback:callback => unit => unit;

Stops any running animation or tracking.

module Timing: { ... };

Animates a value over time using Easing functions.

module Spring: { ... };

Provides a simple spring physics model.

module Decay: { ... };

Starts with an initial velocity and gradually slows to a stop.

let add: value('a) => value('b) => value(calculated);

Creates a new Animated value composed from two Animated values added together.

let divide: value('a) => value('b) => value(calculated);

Creates a new Animated value composed by dividing the first Animated value by the second Animated value.

let subtract: value('a) => value('b) => value(calculated);

Creates a new Animated value composed by subtracting the second Animated value from the first Animated value.

let multiply: value('a) => value('b) => value(calculated);

Creates a new Animated value composed from two Animated values multiplied together.

let modulo: value('a) => float => value(calculated);

Creates a new Animated value that is the (non-negative) modulo of the provided Animated value

let diffClamp: value('a) => float => float => value(calculated);

Create a new Animated value that is limited between 2 values. See React Native documentation for details.BsReactNative

let interpolate: value('a) => inputRange:list(float) => outputRange:[< `float(list(float)) | `string(list(string)) ] => ?⁠easing:BsReactNative.Easing.t => ?⁠extrapolate:Interpolation.extrapolate => ?⁠extrapolateLeft:Interpolation.extrapolate => ?⁠extrapolateRight:Interpolation.extrapolate => unit => value(calculated);

Allows mapping input ranges of an Animated value to different output ranges. See Animation.stop for details. See Interpolation.interpolate for details.