PLAYGROUND (experimental)

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

NameRequiredDefaultDescription
x1yes-x of first point
y1yes-y of first point
cxyes-x of control point
cyyes-y of control point
x2yes-x of second point
y2yes-y of second point
stroke-#000000Stroke color
fill-#FFFFFFFill color
weight-1.00Stroke 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");