Skip to content

Commit

Permalink
remotion: Fix spring() from / to values
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed May 15, 2024
1 parent 1e77c05 commit 0b42b73
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/spring/index.ts
Expand Up @@ -59,8 +59,6 @@ export function spring({
? measureSpring({
fps,
config,
from,
to,
threshold: durationRestThreshold,
})
: undefined;
Expand Down
10 changes: 1 addition & 9 deletions packages/core/src/spring/measure-spring.ts
Expand Up @@ -12,8 +12,6 @@ export function measureSpring({
fps,
config = {},
threshold = 0.005,
from = 0,
to = 1,
}: {
fps: number;
config?: Partial<SpringConfig>;
Expand Down Expand Up @@ -53,8 +51,6 @@ export function measureSpring({
config.mass,
config.overshootClamping,
config.stiffness,
from,
to,
threshold,
].join('-');
if (cache.has(cacheKey)) {
Expand All @@ -63,7 +59,6 @@ export function measureSpring({

validateFps(fps, 'to the measureSpring() function', false);

const range = Math.abs(from - to);
let frame = 0;
let finishedFrame = 0;
const calc = () => {
Expand All @@ -76,10 +71,7 @@ export function measureSpring({

let animation = calc();
const calcDifference = () => {
return (
Math.abs(animation.current - animation.toValue) /
(range === 0 ? 1 : range)
);
return Math.abs(animation.current - animation.toValue);
};

let difference = calcDifference();
Expand Down

0 comments on commit 0b42b73

Please sign in to comment.