Einblick in die generative Gestaltung mit «Processing»

Sechs Kursabende à vier Stunden an der EB Zürich

Kurskonzeption und Leitung Hanna Züllig


< back

						/*
Autor: Sandro Azzati
Kurs: Einblick in die generative Gestaltung mit processing ip971231
Kursleitung: Hanna Zuellig
Veroeffentlicht unter der creative common license Attribution-NonCommercial-ShareAlike
CC BY-NC-SA  http://creativecommons.org/licenses/
*/

/* @pjs preload="sketches/kurstag06/Sandro/data/6472-24.png"; */
/* @pjs preload="sketches/kurstag06/Sandro/data/CharlotteMoorman02.png"; */
/* @pjs preload="sketches/kurstag06/Sandro/data/CharlotteMoorman.png"; */

int NORTH = 0;
int NORTHEAST = 1; 
int EAST = 2;
int SOUTHEAST = 3;
int SOUTH = 4;
int SOUTHWEST = 5;
int WEST = 6;
int NORTHWEST= 7;

float stepSize = 6;
float dimension = 4; // Grösse Bildpunkte (rect)

int direction;
float posX, posY;

PImage bgbild1;
PImage bgbild2;
PImage bgbild3;
PImage bgbild4;
PImage bgbild5;
PImage bgbild6;
PImage bgbild7;
PImage bgbild8;
PImage bgbild9;
PImage bgbild10;
PImage bgbild11;
PImage bgbild12;
PImage bgbild13;
PImage bgbild14;
PImage bgbild15;

void setup() {
  size(1500, 500);
  background(0);
  smooth();
  noStroke();
  rectMode(CENTER);
  frameRate(120);
  posX = width/6;
  posY = height/2;

  
  bgbild10=loadImage("sketches/kurstag06/Sandro/data/6259-19.png"); // Ruinen
  bgbild11=loadImage("sketches/kurstag06/Sandro/data/CharlotteMoorman.png");
 bgbild14=loadImage("sketches/kurstag06/Sandro/data/CharlotteMoorman02.png");
  
}

void draw() {
  drawImage(bgbild11, 0, .5); // (Auswahl Bild, Versatz X-Position, Skalierung Form)
  drawImage(bgbild10, 500, .25);
  drawImage(bgbild14, 1000, .25);
  
}


void drawImage(PImage bild, int verX, float faktor) {

  direction = (int) random(0, 8);

  //println("ich bin "+faktor + "direction" + direction);

  if (direction == NORTH) {  
    posY -= stepSize;
  } 
  else if (direction == NORTHEAST) {
    posX += stepSize;
    posY -= stepSize;
  } 
  else if (direction == EAST) {
    posX += stepSize;
  } 
  else if (direction == SOUTHEAST) {
    posX += stepSize;
    posY += stepSize;
  }
  else if (direction == SOUTH) {
    posY += stepSize;
  }
  else if (direction == SOUTHWEST) {
    posX -= stepSize;
    posY += stepSize;
  }
  else if (direction == WEST) {
    posX -= stepSize;
  }
  else if (direction == NORTHWEST) {
    posX -= stepSize;
    posY -= stepSize;
  }

  if (posX > width/2+verX) posX = 0+verX;
  if (posX+verX < 0) posX = width/2+verX;
  if (posY < 0) posY = height;
  if (posY > height) posY = 0;

  color c = bild.get(int(posX), int(posY));

  fill(c);
  rect(posX+verX, posY, dimension*faktor, dimension*faktor);
}