Eine weitere Übungsaufgabe: Typographie. Typographisch noch
nicht sehr wertvoll, aber es ging um das Laden und Nutzen von
Fonts in Processing.
<- deswegen gibt es da nichts zu sehen:
es ist leider nicht möglich, createfont direkt im browser laufen
zu lassen ohne die processingfontdatei.
PFont myFont;
int x = 100;
int counterA;
int counterB;
int counterC;
int counterI;
char currentCharA;
char currentCharB;
char currentCharC;
char currentCharI;
String[] Zitat = new String [3];
int m = 0;
int k = 0;
int i = 0;
int f = 45;
int posX = int(random(width-50)+25);
int posY = int(random(height-50)+20);
int z = int(random(0,5));
void setup(){
size(640,480);
frameRate(25);
myFont = createFont("Monaco",30,true);
textFont(myFont);
textAlign(CENTER);
smooth();
Zitat[0] = " Farbe ist Leben, ";
Zitat[1] = " denn eine Welt ohne Farben ";
Zitat[2] = " erscheint uns wie tot. ";
}
void draw(){
fill(0,10);
rectMode(CENTER);
rect(width/2,height/2,width,height);
int r[] = {200, 15,240,110, 0,240,220,165, 60, 0,145,255};
int g[] = { 15, 15,220, 0,150,110, 55, 0, 0, 90,190,175};
int b[] = { 15, 200, 0,110, 50, 0, 0, 55,170,120, 0, 0};
fill(r[z],g[z],b[z]);
text(currentCharA,mouseX-Zitat[0].length()/2*30+counterA*18,mouseY);
currentCharA = Zitat[0].charAt(counterA);
if (counterA >= Zitat[0].length()-1) {
text(currentCharB,mouseX-Zitat[1].length()/2*15+counterB*18,mouseY+30);
currentCharB = Zitat[1].charAt(counterB);
if (counterB >= Zitat[1].length()-1) {
text(currentCharC,mouseX-Zitat[2].length()/2*25+counterC*18,mouseY+60);
currentCharC = Zitat[2].charAt(counterC);
if (counterC >= Zitat[2].length()-1) {
counterA = 0;
counterB = 0;
counterC = 0;
z = int(random(0,11));
}
counterC++;
}
else{
counterB++;
}
}
else{
counterA++;
}
if (mousePressed){
int FarbeR[] = { 0,255,255,255, 0, 0};
int FarbeG[] = {255, 0,255, 0,255, 0};
int FarbeB[] = {255,255, 0, 0, 0,255};
String Kontext[] = {" Itten was wrong! "," CMYK "," Lab "," HSV ", " HLS ", " LUV "," RGB" };
fill(FarbeR[m], FarbeG[m], FarbeB[m],50);
text(currentCharI,(posX-Kontext[k].length()/2)+counterI*18,posY);
currentCharI = Kontext[k].charAt(counterI);
if (counterI >= Kontext[k].length()-1) {
counterI = 0;
posX = int(random(width-50)+25);
posY = int(random(height-50)+20);
k = int(random(0,6));
m = int(random(0,5));
}
else{
counterI++;
}
}
}