UNPKG

expo-dev-menu

Version:

Expo/React Native module with the developer menu.

318 lines (287 loc) 7.92 kB
import { IEntryExitAnimationBuilder, EntryExitAnimationBuild, } from '../animationBuilder/commonTypes'; import { BaseAnimationBuilder } from '../animationBuilder/BaseAnimationBuilder'; export class FadeIn extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeIn { return new FadeIn(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return (_) => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(1, config)), }, initialValues: { opacity: 0, }, callback: callback, }; }; }; } export class FadeInRight extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeInRight { return new FadeInRight(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(1, config)), transform: [ { translateX: delayFunction(delay, animation(0, config)) }, ], }, initialValues: { opacity: 0, transform: [{ translateX: 25 }], }, callback: callback, }; }; }; } export class FadeInLeft extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeInLeft { return new FadeInLeft(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(1, config)), transform: [ { translateX: delayFunction(delay, animation(0, config)) }, ], }, initialValues: { opacity: 0, transform: [{ translateX: -25 }], }, callback: callback, }; }; }; } export class FadeInUp extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeInUp { return new FadeInUp(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(1, config)), transform: [ { translateY: delayFunction(delay, animation(0, config)) }, ], }, initialValues: { opacity: 0, transform: [{ translateY: -25 }], }, callback: callback, }; }; }; } export class FadeInDown extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeInDown { return new FadeInDown(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(1, config)), transform: [ { translateY: delayFunction(delay, animation(0, config)) }, ], }, initialValues: { opacity: 0, transform: [{ translateY: 25 }], }, callback: callback, }; }; }; } export class FadeOut extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeOut { return new FadeOut(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return (_) => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(0, config)), }, initialValues: { opacity: 1, }, callback: callback, }; }; }; } export class FadeOutRight extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeOutRight { return new FadeOutRight(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(0, config)), transform: [ { translateX: delayFunction(delay, animation(25, config)) }, ], }, initialValues: { opacity: 1, transform: [{ translateX: 0 }], }, callback: callback, }; }; }; } export class FadeOutLeft extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeOutLeft { return new FadeOutLeft(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(0, config)), transform: [ { translateX: delayFunction(delay, animation(-25, config)) }, ], }, initialValues: { opacity: 1, transform: [{ translateX: 0 }], }, callback: callback, }; }; }; } export class FadeOutUp extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeOutUp { return new FadeOutUp(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(0, config)), transform: [ { translateY: delayFunction(delay, animation(-25, config)) }, ], }, initialValues: { opacity: 1, transform: [{ translateY: 0 }], }, callback: callback, }; }; }; } export class FadeOutDown extends BaseAnimationBuilder implements IEntryExitAnimationBuilder { static createInstance(): FadeOutDown { return new FadeOutDown(); } build: EntryExitAnimationBuild = () => { const delayFunction = this.getDelayFunction(); const [animation, config] = this.getAnimationAndConfig(); const callback = this.callbackV; const delay = this.delayV; return () => { 'worklet'; return { animations: { opacity: delayFunction(delay, animation(0, config)), transform: [ { translateY: delayFunction(delay, animation(25, config)) }, ], }, initialValues: { opacity: 1, transform: [{ translateY: 0 }], }, callback: callback, }; }; }; }