Watch FunProgramming [Video 11] and [Video 12]
Here’s a program I wrote.
int yvalue;
void setup()
{
size(400,400);
background(0); // black screen
strokeWeight(6); // fairly large point size yvalue = 0; // start at the top of the screen
stroke(0,255, 0); // green pen
frameRate(10); // update at 10 frames per second
}
void draw()
{
if(yvalue < 200) // Are we in the top half of the screen?
{
point(200, yvalue); // Yes? = draw one point
}
else // No? = draw two points
{
point(180, yvalue);
point(220, yvalue);
}
yvalue = yvalue + 10;
if (yvalue > 400) // If we are at the bottom of the screen- wrap around
{
yvalue = 0;
background(0);
}
}
Can you change it to split into 1,2,4, 8 lines, like this?
Show a mentor, mark the board and get a prize.