Skip to main content

bezier

bezier() 

Draws a quadratic or cubic bezier curve

let (a, b, c) = ((0, 0), (2, 0), (1, 1))
line(a, c, b, stroke: gray)
bezier(a, b, c)

let (a, b, c, d) = ((0, -1), (2, -1), (.5, -2), (1.5, 0))
line(a, c, d, b, stroke: gray)
bezier(a, b, c, d)

Start position

End position (last coordinate)

..ctrl-style:

The first two positional arguments are taken as cubic bezier control points, where the first is the start control point and the second is the end control point. One control point can be given for a quadratic bezier curve instead. Named arguments are for styling.

Styling

Root bezier

Supports marks.

Anchors

Supports path anchors.

  • ctrl-n: nth control point where n is an integer starting at 0

bezier-through

bezier-through() 

Draws a cubic bezier curve through a set of three points. See bezier for style and anchor details.

let (a, b, c) = ((0, 0), (1, 1), (2, -1))
line(a, b, c, stroke: gray)
bezier-through(a, b, c, name: "b")

// Show calculated control points
line(a, "b.ctrl-0", "b.ctrl-1", c, stroke: gray)

The position to start the curve.

pass-through:

The position to pass the curve through.

The position to end the curve.