From c411edb7c160c55e94fddf62fd60fa1e166351c0 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Mon, 6 Apr 2026 12:59:07 +0200 Subject: fix: clean up --- apps/web/src/lib/animation/interpolation.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'apps/web/src/lib/animation/interpolation.ts') 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({ -- cgit v1.3.1