GMU:Processing im Park/Maike Effenberg/HM1 1

From Medien Wiki
< GMU:Processing im Park‎ | Maike Effenberg
Revision as of 21:46, 13 January 2016 by Bhgvt (talk | contribs) (Created page with "== Code - Homework 1 == <source lang = "java"> PImage img; PImage[] parts = new PImage[9]; int d; void setup() { size(300, 300); d = width / 3; img = loadImage("hund...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Code - Homework 1

PImage img;
PImage[] parts = new PImage[9];
int d;
 
void setup() {
 
  size(300, 300);
  d = width / 3;
 
  img = loadImage("hund7.jpg");
  image(img, 0, 0, 300, 300);
 
 
  // get the parts
  for(int i=0; i<9; i++) {
    int x = (i % 3) * d;
    int y = (i / 3) * d;
    parts[i] = get(x, y, d, d);
  }
 
}
 
void draw() {
 
  background(0);
 
  for(int i=0; i<9; i++) {
    int x = (i % 3) * d;
    int y = (i / 3) * d;
    image(parts[8-i], x, y);
  }
 
}