Expanding circles, how do I do it?


How do I make a circle that starts as a dot and then keeps getting bigger until it disappears?
Also then, how would I have more circles continuously appearing from that same point one after the other so I get what looks like a wave expanding in all directions viewed from above?


Hello and welcome here!

Please read this and build your animation from here:


Look at ellipse to get started:


you need to store width and height of the ellipse. Use a variable d for both

increase d: d=d+1;

then show your animation sketch so far




Here is my progress so far:

float d = 1;

void setup() {
size(640, 360);
stroke(255, 204, 0);

void draw() {

d = (d+1);
ellipse(200, 200, d, d);



nicely done!

Remember to hit ctrl-t in processing to get auto-format (indents)

Next step

Now, you want to have different circles with same center

This calls for arrays!

an Array is a list of values.

so before setup():

int[] ds = new int[1000];   // wrong! d, not ds ;-)
int timer;
int max=0; 

in draw():

for(int i = 0; i<max; i++) {
     ellipse ( 200,200, d[i], d[i] ); 

if(millis()-timer>1400) {
     timer = millis(); 

Chrisir :wink:


I got this error. What does it mean?


please hit ctrl-t in processing
please post your entire code as text

Do you have this:

int[] d = new int[1000]; 

(I had ds there falsely)


ah, I removed the s and now it’s working. Cool!! Thank you so much!

Here is the code so far:

int[] d = new int[1000]; 
int timer;
int max=0; 

void setup() {
  size(1500, 700);

void draw() {

  rect(100, 100, 300, 400);
  stroke(255, 100, 0);
  //ellipse(200, 200, d, d);

  for (int i = 0; i<max; i++) {
    ellipse ( 200, 200, d[i], d[i] ); 

  if (millis()-timer>1400) {
    timer = millis();


well done!

please read the code and understand

  • arrays,
  • timer and
  • why we get slowly more circles.

The sketch will crash after a few minutes. How many? Why?

What does max do?

Auto-Format in processing

hit ctrl-t in processing (or menue Edit | Auto-format)

Formatting in the Forum

Anyway, in the forum after pasting, please mark your code with the mouse and click </> in the command bar

  • to show your code formatted as code when posting in the forum

Chrisir :wink:


Will do!

Thanks!! :smile: