react-native-reanimatable
Version:
Wrapper for Reanimated with an easy declarative API.
26 lines (22 loc) • 1.01 kB
JavaScript
import { ANIMATION_TYPE } from './constants';
import createKeyframesAnimation from './createKeyframesAnimation';
import createTransitionAnimation from './createTransitionAnimation';
// import createAutoTransitionAnimation from './createAutoTransitionAnimation';
import createDelegateAnimation from './createDelegateAnimation';
export default function createConfig(animationConfig) {
const config = {};
if (animationConfig.animation.delegate) {
config.type = ANIMATION_TYPE.DELEGATE;
config.generate = createDelegateAnimation(animationConfig);
} else if (animationConfig.keyframes) {
config.type = ANIMATION_TYPE.KEYFRAMES;
config.generate = createKeyframesAnimation(animationConfig);
} else if (animationConfig.animation.interpolation) {
config.type = ANIMATION_TYPE.INTERPOLATION_TRANSITION;
config.generate = animationConfig;
} else {
config.type = ANIMATION_TYPE.TRANSITION;
config.generate = createTransitionAnimation(animationConfig);
}
return config;
}