Einblick in die generative Gestaltung mit «Processing»

Sechs Kursabende à vier Stunden an der EB Zürich

Kurskonzeption und Leitung Hanna Züllig


< back

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

int[] data;
PFont font;
float winkel = radians(0);
float schritt = radians(10);

void setup() {
  size(500,500);
  background(255);
 // The text from the file is loaded into an array. 
  String[] stuff = loadStrings("sketches/kurstag05/Stephan_CuberB/data/data.txt");
  // This array has one element because the file only has one line. 
  // Convert String into an array of integers using ',' as a delimiter
  data = int(split(stuff[0], ',' ));
  //font=loadFont("Monospaced-14.vlw");
  font = createFont("Monospaced", 12);
  textFont(font);
  stroke(0);
  
  for (int i = 0; i < data.length; i ++ ) {
    // The array of ints is used to set the color and height of each rectangle.
    // fill(data[i]); 
    // rect(i*10,500,10,data[i]*-1);
    line(250,250,250+cos(winkel)*data[i],250+sin(winkel)*data[i]);
    
    fill(0);
    textSize(data[i]/5);
    text(data[i],250+cos(winkel)*data[i],250+sin(winkel)*data[i]);  
   winkel +=schritt;
  }
  
}

void draw() {
  
  if(mousePressed){
    saveFrame("Stephan_CuberB.png");
    
  }
  
  

}