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

**URL:** <https://discourse.processing.org/t/is-this-even-solvable-animation-changes-look-after-some-seconds-help/45097>\
**Category:** Coding Questions\
**Created:** [September 26, 2024, 8:30am UTC](https://discourse.processing.org/t/is-this-even-solvable-animation-changes-look-after-some-seconds-help/45097 "2024-09-26T08:30:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jamone/32/17811_2.png) [@JamOne](https://discourse.processing.org/u/JamOne)\
**Post date:** [September 26, 2024, 8:30am UTC](https://discourse.processing.org/t/is-this-even-solvable-animation-changes-look-after-some-seconds-help/45097/1 "2024-09-26T08:30:31Z")

</div>

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.

```auto
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;

}

```

---

<div class="post-metadata">

**Author:** ![NumericPrime](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/numericprime/32/16318_2.png) [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Post date:** [September 26, 2024, 10:12am UTC](https://discourse.processing.org/t/is-this-even-solvable-animation-changes-look-after-some-seconds-help/45097/2 "2024-09-26T10:12:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JamOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jamone/32/17811_2.png) [@JamOne](https://discourse.processing.org/u/JamOne)\
**Post date:** [September 26, 2024, 10:41am UTC](https://discourse.processing.org/t/is-this-even-solvable-animation-changes-look-after-some-seconds-help/45097/3 "2024-09-26T10:41:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NumericPrime](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/numericprime/32/16318_2.png) [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Post date:** [September 26, 2024, 10:58am UTC](https://discourse.processing.org/t/is-this-even-solvable-animation-changes-look-after-some-seconds-help/45097/4 "2024-09-26T10:58:50Z")

</div>

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:

```auto
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))

```
