FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
    Examples \ Tutorials \ Courses & Workshops
 
   
 
 
Examples for Processing (BETA) version 91+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know.



Milliseconds
by REAS <http://reas.com>

A millisecond is 1/1000 of a second. Processing keeps track of the number of milliseconds a program has run. By modifying this number with the modulo(%) operator, different patterns in time are created.

Created 27 October 2002

   
// Milliseconds 
// by REAS <http://reas.com> 

float scale; 
 
void setup() 
{ 
  size(200, 200); 
  noStroke(); 
  scale = width/10; 
  framerate(30); 
} 
 
void draw() 
{ 
  for(int i=0; i<scale; i++) { 
    colorMode(RGB, (i+1) * scale * 10); 
    fill(millis()%((i+1) * scale * 10) ); 
    rect(i*scale, 0, scale, height); 
  } 
} 
 







   
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info