Source code: moving_bar
Built with Processing
//moving_bar by paul glennon
float myValue;
float myColour;
void setup(){
size(300,200);
background(0);
framerate(20); // setting the speed with framerate.
}
void draw(){
myValue = random(30,225);
myColour = random(30,200);
noStroke();
rect(myValue,48,40,100); // myValue - back and forward
on the x axis.
fill(myColour,0,100); // random is a variety of R between
the above.
}
No. 4
moving_bar by paul glennon 2005
An extension on the movement theme, this time introducing a myValue to move the bar back and forward on the stage.
There is still some vocabulary in this one that I do not understand. Float for example - I need to examine more examples.