UNPKG

react-native-popup-dialog-3

Version:
55 lines (49 loc) 1.16 kB
// flow import { Animated } from 'react-native'; import Animation from './Animation'; export default class ScaleAnimation extends Animation { toValue(toValue: number, onFinished?: Function = () => {}): void { switch (toValue) { case 0: Animated.spring(this.animate, { toValue, velocity: 3, tension: 250, friction: 20, useNativeDriver: this.useNativeDriver, }).start(onFinished); break; case 1: Animated.spring(this.animate, { toValue, velocity: 0, tension: 65, friction: 7, useNativeDriver: this.useNativeDriver, }).start(onFinished); break; default: break; } } createAnimations(): Object { const transform = [ { scale: this.animate.interpolate({ inputRange: [0, 1], outputRange: [0, 1], }), }, { scale: this.animate.interpolate({ inputRange: [0, 1], outputRange: [0, 1], }), }, ]; const animations = { transform, }; return animations; } }