Hello,
I am not able to solve this and need some help. This animation of a ring is just fine in the beginning and I like everything about it, but after some seconds it becomes wilder and wilder and looses its nice appearance.
I think the problem lies somewhere between the lines 68 and 80.
Appreciate every help. Thank you.
int count = 90000;
float level =0.;
float outerRadius = 200.;
float noiseScale = 200;
float noiseStrength = 150;
float noiseZ = 0.01;
float angle = (TAU / count);
float[] x = new float[count];
float[] y = new float[count];
//float[] z = new float[count];
float[] noiseX = new float[count];
float[] noiseY = new float[count];
float xP, yP;
PVector pos, origin;
void setup()
{
size(800, 800);
background(#f6f6f4);
pixelDensity(displayDensity());
smooth(100);
stroke(0, 30);
strokeWeight(3.4);
origin = new PVector(0, 0);
for (int i = 0; i < count; i++)
{
float radius = sqrt(random(0.20, 1.))* outerRadius;
x[i] = cos(angle*i) * radius;
y[i] = sin(angle*i) * radius;
pos = new PVector(x[i], y[i]);
float dist = pos.dist(origin);
pos.normalize();
if (dist > level){
x[i] += pos.x * (random(random(-1.3), random(1.0)) * (sq((level-dist)/35)));
y[i] += pos.y * (random(random(-1.3), random(1.0)) * (sq((level-dist)/35)));
}
}
}
void draw()
{
background(#f6f6f4);
translate (width/2, height/2);
for (int i = 0; i < count; i++)
{
xP = x[i]; // Übernimmt die x Daten aus setup
yP = y[i]; // Übernimmt die x Daten aus setup
pos = new PVector(x[i], y[i]);
pos.normalize();
float n = noise((width/2 + x[i] / noiseScale) - (noiseZ * pos.x) , (height/2 + y[i] / noiseScale ) - (noiseZ* pos.y), noiseY[i]) * noiseStrength ; // BESTES ERGEBNIS. ALLERDINGS WIRD DAS WILDER JE LÄNGER ES LÄUFT
xP = x[i] + pos.x * n;
yP = y[i] + pos.y * n;
point(xP, yP);
}
noiseZ += 0.02;
}