(a: number, b: number, t: number)
| 13 | } |
| 14 | |
| 15 | function smoothStep(a: number, b: number, t: number): number { |
| 16 | t = Math.max(0, Math.min(1, (t - a) / (b - a))) |
| 17 | return t * t * (3 - 2 * t) |
| 18 | } |
| 19 | |
| 20 | function length(x: number, y: number): number { |
| 21 | return Math.sqrt(x * x + y * y) |