xxxxxxxxxx
//matrix-like cascading code
//6/14/15 Added Class
//6/16/15 Added velocity
Character[]things = new Character[50];//list of characters
void setup(){
size(600,600);
background(0);
for(int i = 0; i<things.length; i++){
//create list of characters
things[i] = new Character(random(width),random(height/2),
int(random(5,20)),//velocity
char( int( random(33,126) )));
}
}
void draw(){
frameRate(60);
fill(0,5,0,20);
rect(0,0,width, height);
for(int i = 0; i<things.length; i++){
//update every character
things[i].update();
}
}
class Character{
float x, y;
int vel;
char letter;
Character(float x, float y, int vel, char letter){
this.x = x;
this.y = y;
this.vel = vel;
this.letter = letter;
}
void update(){
this.y += this.vel;
if(this.y > height){
this.y = random(height);
}
textSize(random(20));
fill(0,255,0);
text(char( int( random(33,126) )), this.x, this.y);
}
}