circle
A circle of a given radius.
circle(x: Val, y: Val, radius: Val): Expr
Import shape from shaders/std and use shape.circle.
radius is in uv (1 = the canvas height). Returns the signed distance to the edge, negative inside.
Parameters
| Name | Type | Notes |
|---|---|---|
x | Val | |
y | Val | |
radius | Val |
Example
shape: {distance: ({x, y}, u) => circle(x, y, u('radius')), bounds: {size: {width: 'radius', height: 'radius'}}, …}
Tip. Blend a sharp shape toward this one with
math.mixto round it off (the Polygon shader does).
See also
ellipse— An ellipse with separate horizontal and vertical radii.ring— A ring: a circular band around a centre.polygon— A regular polygon with any number of sides.