Watch FunProgramming [video 21]
Here’s a program I wrote:
float x_value;
void setup()
{
size(400,400);
background(0);
stroke(255);
}
void draw()
{
x_value = (x_value+20) % 400;
line(x_value, 100, x_value+15, 300);
}
void keyPressed()
{
if ( key == 'x' )
{
stroke(random(255),random(255),random(255));
}
}
Type it in and run it - what happens when you hit the “x” key?
Change the program so that when type “r” the lines turn red, “g” - green, or “b” - blue
Change to program so that “f” makes the lines fatter.
Show a mentor, mark the board and get a prize