Skip to content

Commit

Permalink
Update measure-spring.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed May 15, 2024
1 parent 69a159b commit c2275d0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/core/src/spring/measure-spring.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import type {ENABLE_V5_BREAKING_CHANGES} from '../v5-flag.js';
import {validateFps} from '../validation/validate-fps.js';
import type {SpringConfig} from './spring-utils';
import {springCalculation} from './spring-utils.js';

const cache = new Map<string, number>();

type V4Props = {
from?: number;
to?: number;
};

type MeasureSpringProps = {
fps: number;
config?: Partial<SpringConfig>;
threshold?: number;
} & (false extends typeof ENABLE_V5_BREAKING_CHANGES ? V4Props : {});

/**
* @description The function returns how long it takes for a spring animation to settle
* @see [Documentation](https://www.remotion.dev/docs/measure-spring)
Expand All @@ -12,13 +24,7 @@ export function measureSpring({
fps,
config = {},
threshold = 0.005,
}: {
fps: number;
config?: Partial<SpringConfig>;
threshold?: number;
from?: number;
to?: number;
}): number {
}: MeasureSpringProps): number {
if (typeof threshold !== 'number') {
throw new TypeError(
`threshold must be a number, got ${threshold} of type ${typeof threshold}`,
Expand Down

0 comments on commit c2275d0

Please sign in to comment.