sdf-2d/src/helper/clamp.ts
schmelczerandras 77bde04db3 Add files
2020-09-15 10:08:16 +02:00

4 lines
197 B
TypeScript

export const clamp = (value: number, min: number, max: number): number =>
Math.min(max, Math.max(min, value));
export const clamp01 = (value: number): number => Math.min(1, Math.max(0, value));