Typo-Plakat

AnneRoesch

Der Finalentwurf für das Typo-Plakat.
Zusammenarbeit mit Stephanie Hoffmann.
Der Grundcode stammt von: Daniel Shiffman

 
PFont f;
String message = "´´Ich bin nun eben kein Theoretiker.``";
 
Letter[] letters;
Rect[] rects;
int count = 0;
 
void setup() {
 
  size(640,480);
 
  f = createFont("Arial", 35, true);
  textFont(f);
  letters = new Letter[message.length()];
  rects = new Rect[1000]; 
  int x = 38; 
  for (int i = 0; i < message.length(); i ++ ) {
  letters[i] = new Letter(x,240,message.charAt(i)); 
  x += textWidth(message.charAt(i));
}
}
void draw() {
  background(225);
  for (int i = 0; i < count; i ++ ) {
  rects[i].display();
  smooth();
  noStroke();
}
  for (int i = 0; i < letters.length; i ++ ) {
  letters[i].display();
  if (mousePressed) {
  letters[i].shake();
} 
  else {
  letters[i].home();
}
}
}
  class Letter {
  char letter;
  float homex,homey;
  float x,y;
  Letter(float x_, float y_, char letter_) {
  homex = x = x_;
  homey = y = y_;
  letter = letter_;
}
  void display() {
    fill(0);
    textAlign(LEFT);
    text(letter,x,y);
}
  void shake() {
    x += random(-5,5); 
    y += random(-20,20);
}
  void home() { 
    x = homex;
    y = homey;
}
}
  class Rect {
  int durchmesser;
  int xx,yy;
  Rect(int x_, int y_, int durchmesser_) {
  xx = x_;
  yy = y_;
}
    void display() {
    fill(0, 50); 
    rect(xx, yy, 110, 110);
}
}
    void mousePressed(){
    rects[count] = new Rect(mouseX,mouseY,30); 
    count++;
}
void keyPressed(){
}