spiral
spiral(x, y, [rmin=0], [rmax=100], [startangle=0], [sides=100], [space=1], [clockwise=true], [draw=true], [stroke=#000000], [fill=#FFFFFF], [weight=1.00])
Draw a spiral
Syntaxe
spiral(x=10, y=10, radius=5, stroke="#000000", fill="#FFA000", weight=4)
Arguments
| Name | Required | Default | Description |
|---|---|---|---|
x | yes | - | x-coordinate of the center |
y | yes | - | y-coordinate of the center |
rmin | - | 0 | minimum radius |
rmax | - | 100 | minimum radius |
startangle | - | 0 | startAngle |
sides | - | 100 | Number of sides (>2) |
space | - | 1 | Space between each turn |
clockwise | - | true | Clockwise if true, anti- if false |
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 palette = palette_blend("#F2BC00", "#C03228", 10);
var cycle = 5;
canvas(800, 800, "#020410", center=true);
var padding = 20;
var x = 0;
var y = 0;
var radius = height()/2 - padding;
stroke("transparent");
var col = 0;
var totalRings = length(palette) * cycle;
for (var j = 0; j < totalRings; j++) {
var currentRadius = radius - j * (radius / totalRings);
fill(palette[j % length(palette)]);
circle(x, y, currentRadius);
}
save("circle.png");
