Issue regarding loops

I've run into an issue of infinite loops and I am baffled at why. It's a very simple loop. This is the entire length of code here.

function setup() {
  createCanvas(800, 600);
}

function draw() {
  for(var i = 0; i < 5; i++) {
   ellipse(random(800), random(600), 25, 25);
  }

}

As far as I can tell from other peoples code and references to the for loop syntax, this should only run 5 times, yet it is infinite. Changing the second argument in the for loop only seems to either speed up or slow down the amount of ellipses drawn per frame, which also confuses me.

Any help is appreciated, thanks.

Tagged:
Sign In or Register to comment.