fract
The fractional part of a value, 0..1.
fract(x: Val): Expr
Import math from shaders/std and use math.fract.
Repeats a coordinate every whole unit, which is how a pattern tiles.
Parameters
| Name | Type | Notes |
|---|---|---|
x | Val |
Example
const inCell = fract(mul(uv, params.uniforms.tiles)) // 0..1 inside each tile
See also
floor— The value rounded down to a whole number.