xxxxxxxxxx
57
let pos = [];
let vel = [];
let count = 20;
let spacing = 10;
let angle = 0;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
for (let i = 0; i < count; i++) {
pos[i] = 1;
vel[i] = (i + 1) *0.5;
}
}
function draw() {
background("Black");
noFill();
translate(width / 2, height / 2);
strokeWeight(4);
for (let i = 0; i < count; i++) {
stroke(200, 120 * (i / count), 0);
pos[i] = constrain(pos[i], 0, 180);
stroke("#32CD32");
arc(0, 0, (i + 1) * spacing, (i + 1) * spacing, angle + 0, angle + pos[i]);
arc(
0,
0,
(i + 1) * spacing,
(i + 1) * spacing,
angle - 180,
angle - 180 + pos[i]
);
}
push();
stroke("#FF5349");
//strokeWeight(5)
circle(0, 0, 50);
pop();
for (let i = 0; i < count; i++) {
if (pos[i] >= 180 || pos[i] <= 0) {
vel[i] = vel[i] * -1;
}
pos[i] = pos[i] + vel[i];
}
angle = angle + 1.5;
}
function keyPressed() {
if (key === 's') {
saveGif('LOGO 1', 10);
}
}