star_rounded
star_rounded(x, y, r1, r2, branch, [rotation], [round1], [round2], [draw=true], [stroke=#000000], [fill=#FFFFFF], [weight=1.00]) -> NULL || List of points
Draw a star (or return points)
Syntaxe
@todo
Arguments
| Name | Required | Default | Description |
|---|---|---|---|
x | yes | - | Center x |
y | yes | - | Center y |
r1 | yes | - | external radius |
r2 | yes | - | internal radius |
branch | yes | - | number of branches |
rotation | - | - | rotation |
round1 | - | - | outer angle for rounded |
round2 | - | - | inner angle for rounded |
draw | - | true | If false, return a list of points, and don't draw (stroke, fill & weight are ignored) |
stroke | - | #000000 | Stroke color |
fill | - | #FFFFFF | Fill color |
weight | - | 1.00 | Stroke weight (thickness) |
Full example
var cols = 4;
var spacing = 150;
var r = 70;
var startside = 10;
canvas(width=(spacing*cols+r), height=(spacing*cols+r), background="#2E2E2E");
var s = star(x=10, y=-50, r1=100, r2=75, branch=8, rotation=0, draw=false);
// console(s);
for (var i = startside; i >= 3; i--) {
var col = (startside - i) % cols;
var row = floor((startside - i) / cols);
var x = col * spacing + r*1.5;
var y = row * spacing + r*1.5;
star(x=x, y=y, r1=r, r2=25, branch=i, rotation=0, stroke="#000000", fill="#FFA000", weight=4);
}
// star_rounded(x=200, y=200, r1=100, r2=100, branch=6, rotation=0, stroke="#000000", fill="#90CAF9", weight=4, round1=1, round2="Quadratic");
var r2 = r ;
var rot = 0 ;
for (var i = startside; i >= 3; i--) {
var col = (startside - i) % cols;
var row = floor((startside - i) / cols);
var x = col * spacing + r*1.5;
var y = row * spacing + r*1.5 + height()/2;
star(x=x, y=y, r1=r, r2=r2, branch=6, rotation=rot, stroke="#000000", fill="#90CAF9", weight=4);
// stop();
r2 -= 8 ;
rot += 0.15;
}
save("star.png");
