Files
react-native-reanimated/src/derived/diff.js
Dylan Vann ad8b0cf534 Interpolate method, input validation, linting, refactoring. (#17)
Interpolate validations are taken from `Animated`.
2018-06-07 20:24:48 +02:00

13 lines
326 B
JavaScript

import { cond, block, defined, sub, set } from '../base';
import AnimatedValue from '../core/AnimatedValue';
export default function diff(v) {
const stash = new AnimatedValue(0);
const prev = new AnimatedValue();
return block([
set(stash, cond(defined(prev), sub(v, prev), 0)),
set(prev, v),
stash,
]);
}