curve_bezier_quadratic
curve_bezier_quadratic(x1, y1, cx, cy, x2, y2, [stroke=#000000], [fill=#FFFFFF], [weight=1.00])
Draw a quadratic bezier
Syntaxe
curve_bezier_quadratic(x1=10, y1=10, cx=20, cy=20, x2=40, y2=50, stroke="#000");
Arguments
| Name | 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) |
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");
