xxxxxxxxxx
let palette =
[
"#fa823c",
"#ef6239",
"#e44135",
"#d92131",
"#cd002d",
"#ae004e",
"#8e006e",
"#6f008f",
"#4f00af",
];
let slices = 6; //amount of circles in each ring
let radius = 10; //size of each ring
let circles = 20; //amount of rings to make
let circleRadius = 2; //size of each little shape drawn
function setup() {
createCanvas(500, 500);
angleMode(DEGREES);
noStroke();
}
function draw() {
background(0);
//fill in the centre
fill(palette[0]);
circle(width / 2, height / 2, circleRadius);
for (let j = 0; j < circles; j++) {
for (let i = 0; i < slices; i++) {
let slice = 360 / slices;
angle = i * slice;
let x = width / 2 + sin(angle) * radius * (j + 1);
let y = height / 2 + cos(angle) * radius * (j + 1);
let colourNumber = int(
map((x + y) * 0.5 + 1, 0, TWO_PI, 0, palette.length) % palette.length
);
// reverse palette
// fill(palette[palette.length-colourNumber-1]);
fill(palette[colourNumber]);
// radius determined by xy noise
// let circleRadiusNoise = noise(x, y)
// circleRadius = map(circleRadiusNoise, 0, 1, 1, 12)
// radius determined by xy position
circleRadius = circleRadius + colourNumber * 0.75;
circle(x, y, circleRadius);
circleRadius = 2; //reset the circle size
}
slices += 6; //more circles added to each new ring
}
noLoop();
}