mirror of
https://github.com/zhigang1992/react-native-reanimated.git
synced 2026-01-12 22:50:47 +08:00
13 lines
326 B
JavaScript
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,
|
|
]);
|
|
}
|