nick34992
4/19/2016 - 3:33 PM

Ellipse. Using processing.js library.

Ellipse. Using processing.js library.

float x = 512;
float x1 = 10;
float y = 288;
float y1 = 5;

void setup() {
  size(1024, 576); // 16:9
  frameRate(60);
  background(0);
}

void draw() {
  fill (0, 0, 0, 175); 
  stroke (255, 0, 0, 175); 
  strokeWeight(random(15)); 
  ellipse(random(x), random(y), 20, 20);
  x = x + x1;
  y = y + y1;
  if ((x > width -1) || (x < 1)) { 
    x1 = -x1;
    background(random(255), random(255), random(255));
  } 
  if ((y > height - 1) || (y < 1)) { 
    y1 = -y1;
    background(0);
  } 
}