Hello, I am having trouble making a moving background. Here is my code:
int frame;
void setup()
{
size (400,400);
fill(204,102,0);
frameRate (5);
frame = 1;
stroke (255,125,0);
}
void draw()
{
switch (frame)
{
case 1:
background (random (255), random (255), random (255));
rect (0,325,400,325);
stroke (random (255), random (255), random (255));
strokeWeight (10);
line (200,200,225,235);
line (225,235,245,270);
line (245,270,260,305);
line (260,305,270,350);
line (200,200,175,235);
line (175,235,155,270);
line (155,270,140,305);
line (140,305,135,350);
break;
case 2:
background (random (255), random (255), random (255));
rect (0,325,400,325);
stroke (random (255), random (255), random (255));
strokeWeight (10);
line (200,200,220,235);
line (225,235,240,270);
line (245,270,255,305);
line (260,305,265,350);
line (200,200,175,235);
line (175,235,160,265);
line (155,270,145,300);
line (140,305,140,345);
break;
}
frame++;
if (frame > 2)
{
frame = 1;
}
}
this is what I am trying to accomplish.