Is this even solvable? Animation changes look after some seconds... Help

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;


}
1 Like

You basicaly put for each vector pos[i] the points:
pos[i]*noiseZ+offset[i]
through the noise function. However the longer the simulation goes the further these points grow apart up wich causes the noise function to be shown more roughly.
A thing I’d recommend is putting the noiseZ variable in the z parameter of the noise only.
Using noise((pos.x) , (pos.y), noiseZ+i) may resolve your problem.

Hey, thank you for your quick reply.
Your recommendation is a good idea, but since there is no increasing value in the x and y of the noise() we loose the wavy character of the animation.
I think the tricky part is to have an increasing x and y value that respects the circular characteristics without letting them grow apart.

You can try to make to replace z in my response with the distance from 0,0 to x[i],y[i]. Something along the lines of:

noise((width/2 + x[i] / noiseScale) - (pos.x) , (height/2 + y[i] / noiseScale ) - (pos.y), noiseY[i]+noiseZ*dist(x[i],y[i],0,0))