Watch Fun Programming [video 29]
Here’s Mr. Fun’s program. Type in into Processing and run it.
float r = 0;
void setup()
{
size(400,400);
fill(0,0,255);
rectMode(CENTER);
noStroke();
smooth();
}
void draw()
{
fill(0,0,255,50);
rect(width/2,height/2,width, height);
translate(mouseX,mouseY);
rotate(r);
fill(255);
rect(0,0,100,100);
r = r+0.05;
}
Change the program to make the rectangle half as big
Change program to make the rectangle spin slower
Change the program to make the rectangle spin just below the mouse pointer
Change the program to make a “ghost trail” (slower fade out effect) when you move the mouse
Change the program to make the rectangle change color based on mouse position - purple if you are on the left side of the screen, orange if you are on the right side of the screen
Show a mentor, mark the board and claim a prize.