GMU:Processing im Park/Maike Effenberg/HW2

From Medien Wiki

Code - Homework 2

 
PImage img;
int dx= 5;
int dy = 500;
void setup() {
  
  size(500, 700);
   img = loadImage("bild2.jpg");
  image(img, 0, 0, width, height);
      

      
color c = get(50, 350);
fill(c);
noStroke();

float y =50;
boolean flag = true;
for (float x = 40; x < 260; x+=11 ){
  
  if (flag)
  {y+=10;}
  else  {
    y -=10;
}

if (y == 80){
flag = false;
}
if (y == 50){
flag = true;
}
  rect(x, y, dx, dy);
  
  }
}