parallelogram

A parallelogram: a rectangle with its top edge slid sideways.

parallelogram(x: Val, y: Val, width: Val, height: Val, skew: Val): Expr

Import shape from shaders/std and use shape.parallelogram.

width and height are half-extents, in uv. skew is how far the top edge is shifted horizontally, in uv. 0 gives a rectangle.

Parameters

NameTypeNotes
xVal
yVal
widthVal
heightVal
skewVal

Example

shape: {distance: ({x, y}, u) => parallelogram(x, y, u('width'), u('height'), u('skew')), …}

See also

  • trapezoid — A trapezoid: a four-sided shape with a flat top and bottom of different widths.
  • roundedRect — A rectangle with rounded corners.

Used by

Parallelogram