From ecc90f4f22da7fc3c6e90d6fb6f48a5cfe717ab2 Mon Sep 17 00:00:00 2001 From: Andy Stanberry Date: Thu, 16 Aug 2018 16:27:57 -0400 Subject: [PATCH] Add Animated.divide --- src/api/Animated/AnimatedImplementation.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/api/Animated/AnimatedImplementation.js b/src/api/Animated/AnimatedImplementation.js index 07d31cc..1e7001f 100644 --- a/src/api/Animated/AnimatedImplementation.js +++ b/src/api/Animated/AnimatedImplementation.js @@ -736,6 +736,32 @@ class AnimatedMultiplication extends AnimatedWithChildren { } } +class AnimatedDivison extends AnimatedWithChildren { + constructor(a, b) { + super(); + this._a = a; + this._b = b; + } + + __getValue() { + return this._a.__getValue() / this._b.__getValue(); + } + + interpolate(config) { + return new AnimatedInterpolation(this, Interpolation.create(config)); + } + + __attach() { + this._a.__addChild(this); + this._b.__addChild(this); + } + + __detach() { + this._a.__removeChild(this); + this._b.__removeChild(this); + } +} + class AnimatedTransform extends AnimatedWithChildren { constructor(transforms) { super(); @@ -1187,6 +1213,7 @@ const AnimatedImplementation = { spring, add, multiply, + divide, sequence, parallel, stagger,