# Animación en Loop infinito

**URL:** <https://discourse.processing.org/t/animacion-en-loop-infinito/15882>\
**Category:** Español\
**Created:** [November 27, 2019, 2:54pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882 "2019-11-27T14:54:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)\
**Post date:** [November 27, 2019, 2:54pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/1 "2019-11-27T14:54:02Z")

</div>

Hola,

Quiero programar que la siguiente animación se repita indefinidamente cada segundo o segundo y medio, de forma que siempre estén saliendo circunferencias nuevas. ¿Podéis ayudarme? Gracias por adelantado.

```auto

void setup(){
  
  size(270,540);
  background(0,0,0);
  noStroke();
} 

int x=0;
int y=255;

void draw (){
  background(0,0,0);
  strokeWeight(3);
  stroke(255,255,255);
  noFill();
  circle(width/2, height/2, 30);
  stroke(255,255,255,y);
  circle(width/2, height/2, 30+x);
  x=x+1; 
  y=y-1;
}

```

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 27, 2019, 5:17pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/2 "2019-11-27T17:17:24Z")

</div>

I‘m not sure if i got what you want, but maybe something like this? :

```auto
float s = 0;
float y = 0;
float f = 10;

void setup() {
   size(300, 600);
   frameRate(10);
}
void draw() {
   background(255);
   for (int i = 30; i > 0; i--) {
      ellipse(200, 200+y, i*f+s, i*f+s);
   }
   s++;
   y--;
   if (s > f) s = 0;
}

```

---

<div class="post-metadata">

**Author:** ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)\
**Post date:** [November 27, 2019, 5:25pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/3 "2019-11-27T17:25:26Z")

</div>

![11_Radiating](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4da2d4f767f71b90777a06676eea7e414e929271.gif)

gracias por la respuesta, pero es mas bien algo como la animación, la onda que se expande ha de repetirse cada segundo. gracias!

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 27, 2019, 6:00pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/4 "2019-11-27T18:00:57Z")

</div>

```auto
Circle[] circles;

void setup() {
   size(screen.width, screen.height);
   
   circles = new Circle[5];
   
   for (int i = 0; i < circles.length; i++) {
      circles[i] = new Circle(screen.width/2,screen.height/2,20, color(255, 255, 0, 100));
   }
}

void draw() {
   background(255);
   for (int i = 0; i < circles.length; i++) {
      circles[i].display();
      //circles[i].move(0, -1);
      circles[i].scale(1);
      circles[i].fade(3);
   }
   
   if (frameCount%30 == 0) {
      pushCircles();
   }
   
}

void pushCircles () {
   for (int i = 0; i < circles.length-1; i++) {
      circles[i] = circles[i+1];
   }
   circles[circles.length-1] = new Circle(screen.width/2,screen.height/2,20,color(255,255,0));
}

class Circle {
   PVector pos;
   float s;
   color cFill;
   
   Circle (float x, float y, float s_, color f) {
      pos = new PVector(x, y);
      s = s_;
      cFill = f;
   }
   
   void move(float x, float y) {
      pos.add(new PVector(x, y));
   }
   
   void scale(float s_) {
      s += s_;
   }
   
   void fade(float a) {
      cFill = color(red(cFill), green(cFill), blue(cFill), alpha(cFill) - a >= 0 ? alpha(cFill) - a : 0);
   }
   
   void display() {
      stroke(cFill);
      fill(cFill);
      ellipse(pos.x, pos.y, s, s);
   }
}

```

Edited version.

---

<div class="post-metadata">

**Author:** ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)\
**Post date:** [November 27, 2019, 9:50pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/5 "2019-11-27T21:50:09Z")

</div>

I really apreciate last answers, but they are not what I’m looking for.

I need to repeat indefinitely the second circle of my code, the one that is moving, once every second. Thank you so much.

```auto
float x=0;
float y=255;

void setup(){
  
  size(270,540);
  background(0,0,0);
  noStroke();
} 

void draw (){
  background(0,0,0);
  strokeWeight(3);
  stroke(255,255,255);
  noFill();
  circle(width/2, height/2, height/10);
  
  stroke(255,255,255,y);
  circle(width/2, height/2, height/10+x);
  x=x+1; 
  y=y-1;

}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 27, 2019, 10:21pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/6 "2019-11-27T22:21:00Z")

</div>

double post!

> [@Ondas Esféricas que se desvanecen en Loop](https://discourse.processing.org/t/ondas-esfericas-que-se-desvanecen-en-loop/15852/7):
>
> I really apreciate last answers. Now I need to repeat indefinitely the second circle of my code, the one that is moving, once every second. Thank you so much. float x=0; float y=255; void setup(){ size(270,540); background(0,0,0); noStroke(); } void draw (){ background(0,0,0); strokeWeight(3); stroke(255,255,255); noFill(); circle(width/2, height/2, height/10); stroke(255,255,255,y); circle(width/2, height/2, height/10+x); x=x+1; y=y-1; }

---

<div class="post-metadata">

**Author:** ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)\
**Post date:** [November 27, 2019, 11:26pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/7 "2019-11-27T23:26:20Z")

</div>

sorry kll, Im a little bit desperate 😅

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 6, 2019, 6:18pm UTC](https://discourse.processing.org/t/animacion-en-loop-infinito/15882/8 "2019-12-06T18:18:15Z")

</div>


