React Native Redash
Animationsmix()tween2d()snapPoint()ArraysColorsCoordinatesGesturesHooksMathReadmeRun AnimationsSVGStringsTransformationsTransitionsVectors

Animations


mix()

const mix: (value: Animated.Adaptable<number>, x: Animated.Adaptable<number>, y: Animated.Adaptable<number>) => Animated.Node<number>;

mix() performs a linear interpolation between x and y using a to weight between them. The return value is computed as x * (1 - value) + y * value.


tween2d()

const tween2d: (value: Animated.Adaptable<number>, src: Transform2d, dst: Transform2d) => Transform2d;

tween2d() interpolates from any 2d transformation to any other 2d transformation.

const src = [
{ rotateZ: Math.PI / 2}
{ scale: 0.5 }
];
const dst = [
{ skewX: Math.PI / 6 }
];
const progress = useLoop(1000);
const transform = tween2d(progress, src, dst);
return (
<Animated.View style={{ transform }}>
<Card type={Cards.Card1} />
</Animated.View>
)

snapPoint()

const snapPoint: (value: Animated.Adaptable<number>, velocity: Animated.Adaptable<number>, points: Animated.Adaptable<number>[]) => Animated.Adaptable<number>;

Select a point based on a node value and its velocity.