a port of the Processing Visualization Language

Linear

Changing a variable to create a moving line. When the line moves off the edge of the window, the variable is set to 0, which places the line back at the bottom of the screen.

Original Processing.org Example: Linear

// All Examples Written by Casey Reas and Ben Fry

// unless otherwise stated.

float a = 100;



void setup() 

{

  size(200, 200);

  stroke(255);

  frameRate(30);

}



void draw() 

{

  background(51);

  a = a - 1;

  if (a < 0) { 

    a = height; 

  }

  line(0, a, width, a);  

}
Fork me on GitHub