Files
triggerdotdev--trigger.dev/apps/webapp/app/utils/lerp.ts
Matt Aitken 44d443a048 v3 live run reloading and minor style improvements (#925)
* Initial work creating the Redis publishing and subscribing

* Live view is working

* Show the live reloading status on the page

* Fixed some style issues on the run page with James

* Fix for invalid JSX attributes in the ExitIcon svg

* Some sexy shit

* The end line is now correctly coloured

* millisecondsToNanoseconds exported from core/v3 and imported correctly

* Fix for e2e tests, we changed the h1 to an h2

* Tidied imports

* Removed unused hook
2024-03-06 09:48:00 +00:00

16 lines
498 B
TypeScript

/** Linearly interpolates between the min/max values, using t.
* It can't go outside the range */
export function lerp(min: number, max: number, t: number) {
return min + (max - min) * clamp(t, 0, 1);
}
/** Inverse lerp */
export function inverseLerp(min: number, max: number, value: number) {
return (value - min) / (max - min);
}
/** Clamps a value between a min and max */
export function clamp(value: number, min: number, max: number) {
return Math.min(max, Math.max(min, value));
}