TutorialsCourses
Course Menu
Master React Native Animations

Add

Add 2 values.

const position = new Animated.Value(100);
const offset = new Animated.Value(50);

const positionWithOffset = Animated.add(position, offset);

// value = 150;

The positionWithOffset is a new Animated.Value.

Now you could even theoretically compose them deeper.

const position = new Animated.Value(100);
const offset = new Animated.Value(50);

const otherNumber = new Animated.Value(400);

const positionWithOffset = Animated.add(position, offset);

const positionOffsetWithRandomNumber = Animated.add(
  positionWithOffset,
  otherNumber
);

// value = 550;

Live Demo