Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
2D Value for driving 2D animations, such as pan gestures. Almost identical API to normal Animated.Value, but multiplexed. Contains two regular Animated.Values under the hood.

Example


Reference

Methods

setValue()

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

setOffset()

Sets an offset that is applied on top of whatever value is set, whether via setValue, an animation, or Animated.event. Useful for compensating things like the start of a pan gesture. Parameters:

flattenOffset()

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

extractOffset()

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

addListener()

Adds an asynchronous listener to the value so you can observe updates from animations. This is useful because there is no way to synchronously read the value because it might be driven natively. Returns a string that serves as an identifier for the listener. Parameters:

removeListener()

Unregister a listener. The id param shall match the identifier previously returned by addListener(). Parameters:

removeAllListeners()

Remove all registered listeners.

stopAnimation()

Stops any running animation or tracking. callback is invoked with the final value after stopping the animation, which is useful for updating state to match the animation position with layout. Parameters:

resetAnimation()

Stops any animation and resets the value to its original. Parameters:

getLayout()

Converts {x, y} into {left, top} for use in style, e.g.

getTranslateTransform()

Converts {x, y} into a useable translation transform, e.g.
Last modified on May 13, 2026