Einblick in die generative Gestaltung mit «Processing»

Sechs Kursabende à vier Stunden an der EB Zürich

Kurskonzeption und Leitung Hanna Züllig


< back

						/*
Autor: Anja Sitter
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/anja/data/outdoor-flowers-821-2.jpg"; */

int Kachelzahl = 25;
int Kachelseite = 0;
int xKachel = 0;
int yKachel = 0;

PShape Pfeil;
PImage Blumen;


void setup(){
  size(500,500);
  background(255);
  noStroke();
  smooth();
  
  Kachelseite = width/Kachelzahl;
  
  Pfeil = loadShape("sketches/kurstag06/anja/data/pfeil-O.svg");
  Blumen = loadImage("sketches/kurstag06/anja/data/outdoor-flowers-821-2.jpg");
  
}

void draw(){
  
     background(255);
     
          for(int xKachel = 0; xKachel < Kachelzahl+1; xKachel++){
            for(int yKachel = 0; yKachel < Kachelzahl+1; yKachel++){
              
              int x = Kachelseite*xKachel;
              int y = Kachelseite*yKachel;
              
            // Winkel zwischen Mouse-Position und Position der Form
              float Winkel = atan2(mouseY-y, mouseX-x);
              
              color Farbe = Blumen.get(x,y);
              fill(Farbe, mouseX/2);
              
              ellipse (x, y, mouseY/Kachelzahl*2, mouseY/Kachelzahl*2);
              
              
               pushMatrix(); /// Anfang der FormRotation und des Ladens der Form
            
                  translate(x+10,y+10);
        
                  if(mouseX + mouseY > 0){
                      rotate(Winkel);
                  }
              
                  shapeMode(CENTER);
                  shape(Pfeil, 0, 0);
     
              popMatrix();  /// Ende
                 
          } // end for y
        } // end for x
        
        
        
        if(mousePressed){
          
          saveFrame("Anja.png");
          
        }
  
}