Visualize Your Ideas With Code
feat: clamp function
aarthificial94543d1079a4
diff --git a/src/tweening/tweenFunctions.ts b/src/tweening/tweenFunctions.tsindex 5ead14eb..b43de0e9 100644--- a/src/tweening/tweenFunctions.ts+++ b/src/tweening/tweenFunctions.ts@@ -132,6 +132,10 @@ export function remap(return fromOut + ((value - fromIn) * (toOut - fromOut)) / (toIn - fromIn);}+export function clamp(min: number, max: number, value: number) {+ return value < min ? min : value > max ? max : value;+}+export function clampRemap(fromIn: number,toIn: number,@@ -142,9 +146,5 @@ export function clampRemap(const remappedValue = remap(fromIn, toIn, fromOut, toOut, value);if (fromOut > toOut) [fromOut, toOut] = [toOut, fromOut];- return remappedValue < fromOut- ? fromOut- : remappedValue > toOut- ? toOut- : remappedValue;+ return clamp(fromOut, toOut, remappedValue);}