nick34992
4/19/2016 - 4:11 PM

For Loop While. Using p5.js library.

For Loop While. Using p5.js library.

function setup() {
  createCanvas(640, 360);
}

function draw() {
  background(0);
  var x = 16;
  while (x <= width) {
    fill(255, 0, 0);
    ellipse(x, 120, 32, 32);
    x = x + 20;
  }
  for (x = 16; x <= width; x += 20) {
    fill(0, 0, 255);
    ellipse(x, 240, 32, 32);
  }
}