{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withTiming","withSpring","BaseAnimationBuilder","ComplexAnimationBuilder","constructor","arguments","easing","easingFunction","instance","createInstance","easingV","rotate","degree","rotateV","springify","duration","durationV","type","dampingRatio","dampingRatioV","damping","dampingV","mass","massV","stiffness","stiffnessV","overshootClamping","overshootClampingV","restDisplacementThreshold","restDisplacementThresholdV","restSpeedThreshold","restSpeedThresholdV","withInitialValues","values","initialValues","getAnimationAndConfig","animation","config","maybeSetConfigValue","variableName","forEach","_ref"],"sources":["ComplexAnimationBuilder.ts"],"sourcesContent":["'use strict';\nimport { withTiming, withSpring } from '../../animation';\nimport type {\n AnimationFunction,\n BaseBuilderAnimationConfig,\n LayoutAnimationAndConfig,\n} from './commonTypes';\nimport type { EasingFunction } from '../../Easing';\nimport { BaseAnimationBuilder } from './BaseAnimationBuilder';\nimport type { StyleProps } from '../../commonTypes';\n\nexport class ComplexAnimationBuilder extends BaseAnimationBuilder {\n easingV?: EasingFunction;\n rotateV?: string;\n type?: AnimationFunction;\n dampingV?: number;\n dampingRatioV?: number;\n massV?: number;\n stiffnessV?: number;\n overshootClampingV?: number;\n restDisplacementThresholdV?: number;\n restSpeedThresholdV?: number;\n initialValues?: StyleProps;\n\n static createInstance: (\n this: T\n ) => InstanceType;\n\n /**\n * Lets you change the easing curve of the animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param easingFunction - An easing function which defines the animation curve.\n */\n static easing(\n this: T,\n easingFunction: EasingFunction\n ) {\n const instance = this.createInstance();\n return instance.easing(easingFunction);\n }\n\n easing(easingFunction: EasingFunction): this {\n this.easingV = easingFunction;\n return this;\n }\n\n /**\n * Lets you rotate the element. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param degree - The rotation degree.\n */\n static rotate(\n this: T,\n degree: string\n ) {\n const instance = this.createInstance();\n return instance.rotate(degree);\n }\n\n rotate(degree: string): this {\n this.rotateV = degree;\n return this;\n }\n\n /**\n * Enables the spring-based animation configuration. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param duration - An optional duration of the spring animation (in milliseconds).\n */\n static springify(\n this: T,\n duration?: number\n ): ComplexAnimationBuilder {\n const instance = this.createInstance();\n return instance.springify(duration);\n }\n\n springify(duration?: number): this {\n this.durationV = duration;\n this.type = withSpring as AnimationFunction;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation damping ratio. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param dampingRatio - How damped the spring is.\n */\n static dampingRatio(\n this: T,\n dampingRatio: number\n ) {\n const instance = this.createInstance();\n return instance.dampingRatio(dampingRatio);\n }\n\n dampingRatio(value: number): this {\n this.dampingRatioV = value;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation damping. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param value - Decides how quickly a spring stops moving. Higher damping means the spring will come to rest faster.\n */\n static damping(\n this: T,\n damping: number\n ) {\n const instance = this.createInstance();\n return instance.damping(damping);\n }\n\n damping(damping: number): this {\n this.dampingV = damping;\n return this;\n }\n\n /**\n * Lets you adjust the spring animation mass. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param mass - The weight of the spring. Reducing this value makes the animation faster.\n */\n static mass(this: T, mass: number) {\n const instance = this.createInstance();\n return instance.mass(mass);\n }\n\n mass(mass: number): this {\n this.massV = mass;\n return this;\n }\n\n /**\n * Lets you adjust the stiffness of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param stiffness - How bouncy the spring is.\n */\n static stiffness(\n this: T,\n stiffness: number\n ) {\n const instance = this.createInstance();\n return instance.stiffness(stiffness);\n }\n\n stiffness(stiffness: number): this {\n this.stiffnessV = stiffness;\n return this;\n }\n\n /**\n * Lets you adjust overshoot clamping of the spring. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param overshootClamping - Whether a spring can bounce over the final position.\n */\n static overshootClamping(\n this: T,\n overshootClamping: number\n ) {\n const instance = this.createInstance();\n return instance.overshootClamping(overshootClamping);\n }\n\n overshootClamping(overshootClamping: number): this {\n this.overshootClampingV = overshootClamping;\n return this;\n }\n\n /**\n * Lets you adjust the rest displacement threshold of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param restDisplacementThreshold - The displacement below which the spring will snap to the designated position without further oscillations.\n */\n static restDisplacementThreshold(\n this: T,\n restDisplacementThreshold: number\n ) {\n const instance = this.createInstance();\n return instance.restDisplacementThreshold(restDisplacementThreshold);\n }\n\n restDisplacementThreshold(restDisplacementThreshold: number) {\n this.restDisplacementThresholdV = restDisplacementThreshold;\n return this;\n }\n\n /**\n * Lets you adjust the rest speed threshold of the spring animation. Can be chained alongside other [layout animation modifiers](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#layout-animation-modifier).\n *\n * @param restSpeedThreshold - The speed in pixels per second from which the spring will snap to the designated position without further oscillations.\n */\n static restSpeedThreshold(\n this: T,\n restSpeedThreshold: number\n ) {\n const instance = this.createInstance();\n return instance.restSpeedThreshold(restSpeedThreshold);\n }\n\n restSpeedThreshold(restSpeedThreshold: number): this {\n this.restSpeedThresholdV = restSpeedThreshold;\n return this;\n }\n\n /**\n * Lets you override the initial config of the animation\n *\n * @param values - An object containing the styles to override.\n */\n static withInitialValues(\n this: T,\n values: StyleProps\n ) {\n const instance = this.createInstance();\n return instance.withInitialValues(values);\n }\n\n withInitialValues(values: StyleProps): this {\n this.initialValues = values;\n return this;\n }\n\n getAnimationAndConfig(): LayoutAnimationAndConfig {\n const duration = this.durationV;\n const easing = this.easingV;\n const rotate = this.rotateV;\n const type = this.type ? this.type : (withTiming as AnimationFunction);\n const damping = this.dampingV;\n const dampingRatio = this.dampingRatioV;\n const mass = this.massV;\n const stiffness = this.stiffnessV;\n const overshootClamping = this.overshootClampingV;\n const restDisplacementThreshold = this.restDisplacementThresholdV;\n const restSpeedThreshold = this.restSpeedThresholdV;\n\n const animation = type;\n\n const config: BaseBuilderAnimationConfig = {};\n\n function maybeSetConfigValue(\n value: BaseBuilderAnimationConfig[Key],\n variableName: Key\n ) {\n if (value) {\n config[variableName] = value;\n }\n }\n\n if (type === withTiming) {\n maybeSetConfigValue(easing, 'easing');\n }\n\n (\n [\n { variableName: 'damping', value: damping },\n { variableName: 'dampingRatio', value: dampingRatio },\n { variableName: 'mass', value: mass },\n { variableName: 'stiffness', value: stiffness },\n { variableName: 'overshootClamping', value: overshootClamping },\n {\n variableName: 'restDisplacementThreshold',\n value: restDisplacementThreshold,\n },\n { variableName: 'restSpeedThreshold', value: restSpeedThreshold },\n { variableName: 'duration', value: duration },\n { variableName: 'rotate', value: rotate },\n ] as const\n ).forEach(({ value, variableName }) =>\n maybeSetConfigValue(value, variableName)\n );\n\n return [animation, config];\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,C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