Course Menu

Math

Previously Animated had no way to do simple math for animations. In order to do any sort of math you would have had to use a listener with addListener to track the current value and then call setValue. Additionally you could have used setOffset.

The only issue is that this is cumbersome, inflexible, async, and isn't declarative. To help with this Animated had basic math options added. Including add, divide, multiply and moduolo. These can all be used in conjunction with each other as many times as you'd like.

They also can operate on any Animated.Value or simple numbers can used in place of an Animated.Value.

The math functions don't always seem immediately valuable on first glance but because you can compose them you can build out formulas with them. Also because you are combining 2 different Animated.Values they are able to be animated separately, in conjunction, or whatever is required.