diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-06 12:59:07 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-06 12:59:07 +0200 |
| commit | c411edb7c160c55e94fddf62fd60fa1e166351c0 (patch) | |
| tree | 39495bfc8120590c93943a396cce2b477d3faa6c /apps/web/src/lib/animation/interpolation.ts | |
| parent | 2776adaae1512bf925c5bb4564b311b37f46202d (diff) | |
| download | opencut-c411edb7c160c55e94fddf62fd60fa1e166351c0.tar.gz | |
fix: clean up
Diffstat (limited to 'apps/web/src/lib/animation/interpolation.ts')
| -rw-r--r-- | apps/web/src/lib/animation/interpolation.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/web/src/lib/animation/interpolation.ts b/apps/web/src/lib/animation/interpolation.ts index 9609441c..67456aa0 100644 --- a/apps/web/src/lib/animation/interpolation.ts +++ b/apps/web/src/lib/animation/interpolation.ts @@ -9,6 +9,7 @@ import type { ScalarSegmentType, } from "@/lib/animation/types"; import { TIME_EPSILON_SECONDS } from "@/constants/animation-constants"; +import { clamp } from "@/utils/math"; import { getBezierPoint, getDefaultLeftHandle, @@ -41,10 +42,6 @@ function isWithinTimePair({ ); } -function clamp01({ value }: { value: number }): number { - return Math.max(0, Math.min(1, value)); -} - function lerpNumber({ leftValue, rightValue, @@ -287,8 +284,10 @@ export function getScalarChannelValueAtTime({ return rightKey.value; } - const progress = clamp01({ + const progress = clamp({ value: (time - leftKey.time) / span, + min: 0, + max: 1, }); if (leftKey.segmentToNext === "linear") { return lerpNumber({ |
