Hello, I struggle with this code. I even tried to talk to the ChatGBT but didn’t help.
For some reason, “dist” creates big dips in its values and therefore bigger ellipses on the path where they should not be. See image.
How can I get rid of the big circles and just have the smooth line?
Can somebody help? Thank you.
import processing.pdf.*;
import java.util.*;
PVector loc;
PVector old;
float angle, noiseZ, radiusN;
float radius = 100;
float ellipseSize;
float oldX, oldY, oldDist;
float alpha, size;
float maxDist;
void setup() {
size(800, 800);
pixelDensity(displayDensity());
noiseSeed(145000);
noiseDetail(1, 0.9);
background(255);
smooth(10);
loc = new PVector(width/2, height/2);
old = new PVector(0, 0);
maxDist = 1;
noiseZ = 0.0;
}
void draw() {
noStroke();
translate(width/2, height/2);
radiusN = radius + (1.0-sqrt(noise(noiseZ))) * 340; // SUPER
float n = map(noise(noiseZ/2), 0. , 1.0 , -PI, PI);
loc.x = cos(angle + n) * radiusN;
loc.y = sin(angle + n) * radiusN;
float dist = loc.dist(old);
old = loc.copy();
if (frameCount > 6) {
fill(dist*50,0,0.0, map(dist, 0., 4, 5, 30));
ellipseSize = map(dist, 0.0, 4., 50., 5.);
ellipse(loc.x, loc.y, ellipseSize, ellipseSize);
}
angle += 0.005 ;
noiseZ += 0.01;
}