polygon_arc_corner
polygon_arc_corner(x, y, radius, position, [draw=true], [stroke], [fill], [weight]) -> NULL || List of points
Return points of a rounded corner
Syntaxe
var result = polygon_arc_corner(
Arguments
| Name | Required | Default | Description |
|---|---|---|---|
x | yes | - | Center x |
y | yes | - | Center y |
radius | yes | - | radius |
position | yes | - | 0=topright, 1=bottomright, 2=bottomleft, 3=topleft |
draw | - | true | If false, return a list of points, and don't draw (stroke, fill & weight are ignored) |
stroke | - | - | Stroke color |
fill | - | - | Fill color |
weight | - | - | Stroke weight (thickness) |
Full example
canvas(width=500, height=500, background="#2E2E2E", center=true);
var colors = ["#E5B567", "#6C99BB", "#9E86C8", "#E87D3E"];
weight(0);
var side = 500;
var ratio = TAU / 10 ; // le TAU se resserre...
var allRadius = [];
for (var i = 0; i < 10; i++) {
allRadius.add(side / 2);
side = side * ratio;
}
for (var i = 0; i < allRadius.length; i++) {
var radius = allRadius[i];
for (var j = 0; j < 4; j++) {
var col = colors[(i + j) % colors.length];
polygon_arc_corner(0, 0, radius, j, fill=col);
}
}
var pac = polygon_arc_corner(0,0,200,3, draw=false);
console(pac); // [-200, 0, -200, 0, -199.0008330556, -19.9666833294... ]
save("polygon_arc_corner.png");
