curve_bezier_quadratic
Draw a quadratic bezier
curve_bezier_quadratic(
x1,
y1,
cx,
cy,
x2,
y2,
[stroke=#000000],
[fill=#FFFFFF],
[weight=1.00],
[draw=true]
)
Draw a quadratic bezier
Syntaxe
curve_bezier_quadratic(x1=10, y1=10, cx=20, cy=20, x2=40, y2=50, stroke="#000");
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
x1 | yes | - | x of first point | |
y1 | yes | - | y of first point | |
cx | yes | - | x of control point | |
cy | yes | - | y of control point | |
x2 | yes | - | x of second point | |
y2 | yes | - | y of second point | |
stroke | - | #000000 | Stroke color | |
fill | - | #FFFFFF | Fill color | |
weight | - | 1.00 | Stroke weight (thickness) | |
draw | - | true | If false, return a list of points, and don't draw (stroke, fill & weight are ignored) |
Full example
canvas(600, 600, "#020410");
stroke("FFC107AA");
fill("transparent");
weight(5);
var step = 20 ;
for (var y=step; y<=height()-step;y+=step) {
var x1 = step;
var y1 = y;
var x2 = width()-step;
var y2 = y1;
var cy = random( y-step*2, y+step*2 );
curve_bezier_quadratic(x1=x1, y1=y1, cx=width()/2, cy=cy, x2=x2, y2=y2);
curve_bezier_quadratic(x1=y1, y1=x1, cy=width()/2, cx=cy, x2=y2, y2=x2);
}
save(whoami() + ".png");
