xxxxxxxxxx
/*
Organic
Author:
Jason Labbe
Site:
jasonlabbe3d.com
*/
function setup() {
createCanvas(windowWidth, windowHeight);
mouseX = width / 4;
}
function draw() {
let f = frameCount;
background(0);
stroke(255);
strokeWeight(0.7);
noFill();
translate(width / 2, height / 2);
rotate(-f * 0.001);
for (let rad = 0; rad < TWO_PI; rad += map(mouseX, 0, width, 0.02, 0.1)) {
push();
rotate(rad);
// Kill noise at start/end so they don't overlap.
let weight = 1;
if (rad < QUARTER_PI) {
weight = map(rad, 0, QUARTER_PI, 0, 1);
} else if (rad > TWO_PI - QUARTER_PI) {
weight = map(rad, TWO_PI - QUARTER_PI, TWO_PI, 1, 0);
}
let n1 = map(noise(f * 0.001 + rad), 0, 1, -2, 2) * weight;
let n2 = map(noise((1000 + f) * 0.001 + rad), 0, 1, -2, 2) * weight;
beginShape();
curveVertex(0, 0);
curveVertex(sin(f * 0.04 - 5 + n1) * 25, 100);
curveVertex(cos(f * 0.04 - 2.5 + n2) * 50, 200);
curveVertex(sin(f * 0.04 + n1) * 75, 300);
curveVertex(0, 400);
curveVertex(0, 500);
endShape();
pop();
}
}