{"version":3,"names":["checkIfConfigIsValid","config","_config$clamp","_config$clamp2","errorMessage","forEach","prop","value","duration","clamp","min","max","console","warn","bisectRoot","_ref","func","maxIterations","ACCURACY","idx","current","Math","abs","initialCalculations","mass","arguments","length","undefined","skipAnimation","zeta","omega0","omega1","useDuration","stiffness","k","dampingRatio","sqrt","damping","c","m","scaleZetaToMatchClamps","animation","toValue","startValue","toValueNum","Number","firstBound","secondBound","relativeExtremum1","relativeExtremum2","newZeta1","log","PI","newZeta2","zetaSatisfyingClamp","filter","x","calculateNewMassToMatchDuration","x0","v0","restSpeedThreshold","threshold","durationForMass","amplitude","exp","criticallyDampedSpringCalculations","precalculatedValues","t","criticallyDampedEnvelope","criticallyDampedPosition","criticallyDampedVelocity","position","velocity","underDampedSpringCalculations","sin1","sin","cos1","cos","underDampedEnvelope","underDampedFrag1","underDampedPosition","underDampedVelocity","isAnimationTerminatingCalculation","isOvershooting","overshootClamping","isVelocity","isDisplacement","restDisplacementThreshold"],"sources":["springUtils.ts"],"sourcesContent":["'use strict';\nimport type {\n Animation,\n AnimatableValue,\n Timestamp,\n ReduceMotion,\n} from '../commonTypes';\n\n/**\n * Spring animation configuration.\n *\n * @param mass - The weight of the spring. Reducing this value makes the animation faster. Defaults to 1.\n * @param damping - How quickly a spring slows down. Higher damping means the spring will come to rest faster. Defaults to 10.\n * @param duration - Length of the animation (in milliseconds). Defaults to 2000.\n * @param dampingRatio - How damped the spring is. Value 1 means the spring is critically damped, and value \\>1 means the spring is overdamped. Defaults to 0.5.\n * @param stiffness - How bouncy the spring is. Defaults to 100.\n * @param velocity - Initial velocity applied to the spring equation. Defaults to 0.\n * @param overshootClamping - Whether a spring can bounce over the `toValue`. Defaults to false.\n * @param restDisplacementThreshold - The displacement below which the spring will snap to toValue without further oscillations. Defaults to 0.01.\n * @param restSpeedThreshold - The speed in pixels per second from which the spring will snap to toValue without further oscillations. Defaults to 2.\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withSpring/#config-\n */\nexport type SpringConfig = {\n stiffness?: number;\n overshootClamping?: boolean;\n restDisplacementThreshold?: number;\n restSpeedThreshold?: number;\n velocity?: number;\n reduceMotion?: ReduceMotion;\n} & (\n | {\n mass?: number;\n damping?: number;\n duration?: never;\n dampingRatio?: never;\n clamp?: never;\n }\n | {\n mass?: never;\n damping?: never;\n duration?: number;\n dampingRatio?: number;\n clamp?: { min?: number; max?: number };\n }\n);\n\n// This type contains all the properties from SpringConfig, which are changed to be required,\n// except for optional 'reduceMotion' and 'clamp'\nexport type DefaultSpringConfig = {\n [K in keyof Required<SpringConfig>]: K extends 'reduceMotion' | 'clamp'\n ? Required<SpringConfig>[K] | undefined\n : Required<SpringConfig>[K];\n};\nexport type WithSpringConfig = SpringConfig;\n\nexport interface SpringConfigInner {\n useDuration: boolean;\n skipAnimation: boolean;\n}\n\nexport interface SpringAnimation extends Animation<SpringAnimation> {\n current: AnimatableValue;\n toValue: AnimatableValue;\n velocity: number;\n lastTimestamp: Timestamp;\n startTimestamp: Timestamp;\n startValue: number;\n zeta: number;\n omega0: number;\n omega1: number;\n}\n\nexport interface InnerSpringAnimation\n extends Omit<SpringAnimation, 'toValue' | 'current'> {\n toValue: number;\n current: number;\n}\nexport function checkIfConfigIsValid(config: DefaultSpringConfig): boolean {\n 'worklet';\n let errorMessage = '';\n (\n [\n 'stiffness',\n 'damping',\n 'dampingRatio',\n 'restDisplacementThreshold',\n 'restSpeedThreshold',\n 'mass',\n ] as const\n ).forEach((prop) => {\n const value = config[prop];\n if (value <= 0) {\n errorMessage += `, ${prop} must be grater than zero but got ${value}`;\n }\n });\n\n if (config.duration < 0) {\n errorMessage += `, duration can't be negative, got ${config.duration}`;\n }\n\n if (\n config.clamp?.min &&\n config.clamp?.max &&\n config.clamp.min > config.clamp.max\n ) {\n errorMessage += `, clamp.min should be lower than clamp.max, got clamp: {min: ${config.clamp.min}, max: ${config.clamp.max}} `;\n }\n\n if (errorMessage !== '') {\n console.warn('[Reanimated] Invalid spring config' + errorMessage);\n }\n\n return errorMessage === '';\n}\n\n// ts-prune-ignore-next This function is exported to be tested\nexport function bisectRoot({\n min,\n max,\n func,\n maxIterations = 20,\n}: {\n min: number;\n max: number;\n func: (x: number) => number;\n maxIterations?: number;\n}) {\n 'worklet';\n const ACCURACY = 0.00005;\n let idx = maxIterations;\n let current = (max + min) / 2;\n while (Math.abs(func(current)) > ACCURACY && idx > 0) {\n idx -= 1;\n\n if (func(current) < 0) {\n min = current;\n } else {\n max = current;\n }\n current = (min + max) / 2;\n }\n return current;\n}\n\nexport function initialCalculations(\n mass = 0,\n config: DefaultSpringConfig & SpringConfigInner\n): {\n zeta: number;\n omega0: number;\n omega1: number;\n} {\n 'worklet';\n\n if (config.skipAnimation) {\n return { zeta: 0, omega0: 0, omega1: 0 };\n }\n\n if (config.useDuration) {\n const { stiffness: k, dampingRatio: zeta } = config;\n\n /** omega0 and omega1 denote angular frequency and natural angular frequency, see this link for formulas:\n * https://courses.lumenlearning.com/suny-osuniversityphysics/chapter/15-5-damped-oscillations/\n */\n const omega0 = Math.sqrt(k / mass);\n const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);\n\n return { zeta, omega0, omega1 };\n } else {\n const { damping: c, mass: m, stiffness: k } = config;\n\n const zeta = c / (2 * Math.sqrt(k * m)); // damping ratio\n const omega0 = Math.sqrt(k / m); // undamped angular frequency of the oscillator (rad/ms)\n const omega1 = omega0 * Math.sqrt(1 - zeta ** 2); // exponential decay\n\n return { zeta, omega0, omega1 };\n }\n}\n\n/** We make an assumption that we can manipulate zeta without changing duration of movement.\n * According to theory this change is small and tests shows that we can indeed ignore it.\n */\nexport function scaleZetaToMatchClamps(\n animation: SpringAnimation,\n clamp: { min?: number; max?: number }\n): number {\n 'worklet';\n const { zeta, toValue, startValue } = animation;\n const toValueNum = Number(toValue);\n\n if (toValueNum === startValue) {\n return zeta;\n }\n\n const [firstBound, secondBound] =\n toValueNum - startValue > 0\n ? [clamp.min, clamp.max]\n : [clamp.max, clamp.min];\n\n /** The extrema we get from equation below are relative (we obtain a ratio),\n * To get absolute extrema we convert it as follows:\n *\n * AbsoluteExtremum = startValue ± RelativeExtremum * (toValue - startValue)\n * Where ± denotes:\n * + if extremum is over the target\n * - otherwise\n */\n\n const relativeExtremum1 =\n secondBound !== undefined\n ? Math.abs((secondBound - toValueNum) / (toValueNum - startValue))\n : undefined;\n\n const relativeExtremum2 =\n firstBound !== undefined\n ? Math.abs((firstBound - toValueNum) / (toValueNum - startValue))\n : undefined;\n\n /** Use this formula http://hyperphysics.phy-astr.gsu.edu/hbase/oscda.html to calculate\n * first two extrema. These extrema are located where cos = +- 1\n *\n * Therefore the first two extrema are:\n *\n * Math.exp(-zeta * Math.PI); (over the target)\n * Math.exp(-zeta * 2 * Math.PI); (before the target)\n */\n\n const newZeta1 =\n relativeExtremum1 !== undefined\n ? Math.abs(Math.log(relativeExtremum1) / Math.PI)\n : undefined;\n\n const newZeta2 =\n relativeExtremum2 !== undefined\n ? Math.abs(Math.log(relativeExtremum2) / (2 * Math.PI))\n : undefined;\n\n const zetaSatisfyingClamp = [newZeta1, newZeta2].filter(\n (x: number | undefined): x is number => x !== undefined\n );\n // The bigger is zeta the smaller are bounces, we return the biggest one\n // because it should satisfy all conditions\n return Math.max(...zetaSatisfyingClamp, zeta);\n}\n\n/** Runs before initial */\nexport function calculateNewMassToMatchDuration(\n x0: number,\n config: DefaultSpringConfig & SpringConfigInner,\n v0: number\n) {\n 'worklet';\n if (config.skipAnimation) {\n return 0;\n }\n\n /** Use this formula: https://phys.libretexts.org/Bookshelves/University_Physics/Book%3A_University_Physics_(OpenStax)/Book%3A_University_Physics_I_-_Mechanics_Sound_Oscillations_and_Waves_(OpenStax)/15%3A_Oscillations/15.06%3A_Damped_Oscillations\n * to find the asymptote and estimate the damping that gives us the expected duration \n\n ⎛ ⎛ c⎞ ⎞ \n ⎜-⎜──⎟ â‹… duration⎟ \n ⎠âŽ2m⎠⎠\n A â‹… e = threshold\n\n \n Amplitude calculated using \"Conservation of energy\"\n _________________\n ╱ 2 2\n ╱ m â‹… v0 + k â‹… x0 \n amplitude = ╱ ─────────────────\n ╲╱ k \n\n And replace mass with damping ratio which is provided: m = (c^2)/(4 * k * zeta^2) \n */\n const {\n stiffness: k,\n dampingRatio: zeta,\n restSpeedThreshold: threshold,\n duration,\n } = config;\n\n const durationForMass = (mass: number) => {\n 'worklet';\n const amplitude =\n (mass * v0 * v0 + k * x0 * x0) / (Math.exp(1 - 0.5 * zeta) * k);\n const c = zeta * 2 * Math.sqrt(k * mass);\n return (\n 1000 * ((-2 * mass) / c) * Math.log((threshold * 0.01) / amplitude) -\n duration\n );\n };\n\n // Bisection turns out to be much faster than Newton's method in our case\n return bisectRoot({ min: 0, max: 100, func: durationForMass });\n}\n\nexport function criticallyDampedSpringCalculations(\n animation: InnerSpringAnimation,\n precalculatedValues: {\n v0: number;\n x0: number;\n omega0: number;\n t: number;\n }\n): { position: number; velocity: number } {\n 'worklet';\n const { toValue } = animation;\n\n const { v0, x0, omega0, t } = precalculatedValues;\n\n const criticallyDampedEnvelope = Math.exp(-omega0 * t);\n const criticallyDampedPosition =\n toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);\n\n const criticallyDampedVelocity =\n criticallyDampedEnvelope *\n (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);\n\n return {\n position: criticallyDampedPosition,\n velocity: criticallyDampedVelocity,\n };\n}\n\nexport function underDampedSpringCalculations(\n animation: InnerSpringAnimation,\n precalculatedValues: {\n zeta: number;\n v0: number;\n x0: number;\n omega0: number;\n omega1: number;\n t: number;\n }\n): { position: number; velocity: number } {\n 'worklet';\n const { toValue, current, velocity } = animation;\n\n const { zeta, t, omega0, omega1 } = precalculatedValues;\n\n const v0 = -velocity;\n const x0 = toValue - current;\n\n const sin1 = Math.sin(omega1 * t);\n const cos1 = Math.cos(omega1 * t);\n\n // under damped\n const underDampedEnvelope = Math.exp(-zeta * omega0 * t);\n const underDampedFrag1 =\n underDampedEnvelope *\n (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);\n\n const underDampedPosition = toValue - underDampedFrag1;\n // This looks crazy -- it's actually just the derivative of the oscillation function\n const underDampedVelocity =\n zeta * omega0 * underDampedFrag1 -\n underDampedEnvelope *\n (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);\n\n return { position: underDampedPosition, velocity: underDampedVelocity };\n}\n\nexport function isAnimationTerminatingCalculation(\n animation: InnerSpringAnimation,\n config: DefaultSpringConfig\n): {\n isOvershooting: boolean;\n isVelocity: boolean;\n isDisplacement: boolean;\n} {\n 'worklet';\n const { toValue, velocity, startValue, current } = animation;\n\n const isOvershooting = config.overshootClamping\n ? (current > toValue && startValue < toValue) ||\n (current < toValue && startValue > toValue)\n : false;\n\n const isVelocity = Math.abs(velocity) < config.restSpeedThreshold;\n const isDisplacement =\n Math.abs(toValue - current) < config.restDisplacementThreshold;\n\n return { isOvershooting, isVelocity, isDisplacement };\n}\n"],"mappings":"AAAA,YAAY;;AAQZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AA8BA,OAAO,SAASA,oBAAoBA,CAACC,MAA2B,EAAW;EACzE,SAAS;;EAAC,IAAAC,aAAA,EAAAC,cAAA;EACV,IAAIC,YAAY,GAAG,EAAE;EAEnB,CACE,WAAW,EACX,SAAS,EACT,cAAc,EACd,2BAA2B,EAC3B,oBAAoB,EACpB,MAAM,CACP,CACDC,OAAO,CAAEC,IAAI,IAAK;IAClB,MAAMC,KAAK,GAAGN,MAAM,CAACK,IAAI,CAAC;IAC1B,IAAIC,KAAK,IAAI,CAAC,EAAE;MACdH,YAAY,IAAK,KAAIE,IAAK,qCAAoCC,KAAM,EAAC;IACvE;EACF,CAAC,CAAC;EAEF,IAAIN,MAAM,CAACO,QAAQ,GAAG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