nature
weird web October Pen - Nature
let colors = [];
function setup() {
c = min(windowWidth * 0.9, windowHeight * 0.9);
describe(
"a round circle like a sun sits in the center of a long canvas as waves of color move behind and infront of it."
);
createCanvas(c / 2, c);
rectMode(CENTER);
sunCol = color(255, random(200, 240), random(100, 130), 150);
nColors = int(random(20, 35));
for (let i = 0; i < nColors; i++) {
colors[i] = {
tOff: random(-2 * PI, 2 * PI),
col: color(
random(200, 255),
random(170, 250),
random(130, 250),
random(10, 50)
),
a: random(-width / 10, width / 6),
b: random(-width / 8, width / 10),
c: random(-width / 10, width / 10),
d: random(-width / 10, width / 10),
sw: random(width / 10, height / 2),
a1: random(2, 5),
b1: random(2, 5),
r: random(100, 500),
y: random(-height / 1.5, height / 1.5)
};
}
noStroke();
}
function draw() {
background(20, 40, 55, 70);
translate(width / 2, height / 2);
t = frameCount / 100;
noFill();
for (let i = 0; i < colors.length / 2; i++) {
strokeWeight(colors[i].sw);
stroke(colors[i].col);
beginShape();
for (let j = -width / 2; j < width / 2; j++) {
x = j;
y =
colors[i].y +
sin(t + j / 100 - colors[i].tOff) *
colors[i].a *
cos(j / colors[i].r + t / colors[i].a1) -
colors[i].b * sin(j / colors[i].r + t / colors[i].b1 + colors[i].tOff) +
colors[i].c *
sin(j / colors[i].r + t / colors[i].b1 + colors[i].tOff) *
cos(t - j / colors[i].r) +
colors[i].d *
cos(j / colors[i].r - t / colors[i].b1 + colors[i].tOff) *
cos(t - j / colors[i].r);
vertex(x, y);
}
endShape();
}
fill(sunCol);
noStroke();
circle(0, 0, width / 3);
noFill();
for (let i = int(colors.length / 2); i < colors.length; i++) {
strokeWeight(colors[i].sw);
stroke(colors[i].col);
beginShape();
for (let j = -width / 2; j < width / 2; j++) {
x = j;
y =
colors[i].a * cos(j / 100 + t / colors[i].a1) -
colors[i].b * sin(j / 100 + t / colors[i].b1 + colors[i].tOff) +
colors[i].c *
sin(j / 100 + t / colors[i].b1 + colors[i].tOff) *
cos(t - j / 100);
vertex(x, y);
}
endShape();
}
}
function mousePressed() {
setup();
draw();
}
function windowResized() {
resizeCanvas(windowWidth * 0.9, windowHeight * 0.9);
}