(n)
| 2382 | } |
| 2383 | |
| 2384 | function number(n) { |
| 2385 | if (n instanceof tree.Dimension) { |
| 2386 | return parseFloat(n.unit.is('%') ? n.value / 100 : n.value); |
| 2387 | } else if (typeof(n) === 'number') { |
| 2388 | return n; |
| 2389 | } else { |
| 2390 | throw { |
| 2391 | error: "RuntimeError", |
| 2392 | message: "color functions take numbers as parameters" |
| 2393 | }; |
| 2394 | } |
| 2395 | } |
| 2396 | |
| 2397 | function clamp(val) { |
| 2398 | return Math.min(1, Math.max(0, val)); |