math.ts

src/utils/math.ts
/** Math helpers shared across scenes. */
export const clamp = (value: number, min: number, max: number): number =>
Math.max(min, Math.min(max, value));
export const lerp = (a: number, b: number, t: number): number => a + (b - a) * t;
export const randRange = (min: number, max: number): number =>
min + Math.random() * (max - min);
export const randInt = (min: number, max: number): number =>
Math.floor(randRange(min, max + 1));

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC