trapezoid
A trapezoid: a four-sided shape with a flat top and bottom of different widths.
trapezoid(x: Val, y: Val, topWidth: Val, bottomWidth: Val, height: Val): Expr
Import shape from shaders/std and use shape.trapezoid.
topWidth and bottomWidth are half-widths of the top and bottom edges as seen on screen, height the half-height, all in uv. Equal widths give a rectangle.
Parameters
| Name | Type | Notes |
|---|---|---|
x | Val | |
y | Val | |
topWidth | Val | |
bottomWidth | Val | |
height | Val |
Example
shape: {distance: ({x, y}, u) => trapezoid(x, y, u('topWidth'), u('bottomWidth'), u('height')), …}
See also
parallelogram— A parallelogram: a rectangle with its top edge slid sideways.roundedRect— A rectangle with rounded corners.