PLAYGROUND (experimental)

curve_bezier_cubic

curve_bezier_cubic(x1, y1, cx1, cy1, cx2, cy2, x2, y2, [stroke=#000000], [fill=#FFFFFF], [weight=1.00])

Draw a cubic bezier

Syntaxe

curve_bezier_cubic(x1=10, y1=10, cx1=20, cy1=20, cx2=20, cy2=20, x2=40, y2=50, stroke="#000");

Arguments

NameRequiredDefaultDescription
x1yes-x of first point
y1yes-y of first point
cx1yes-x of first control point
cy1yes-y of first control point
cx2yes-x of second control point
cy2yes-y of second 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("");
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*4, y+step*4);

    curve_bezier_cubic(
        x1=x1, y1=y1, 
        cx1=width()/2, cy1=width()/2, 
        cx2=width()/3, cy2=-cy, 
        x2=x2, y2=y2
    );
}

save(whoami() + ".png");