3. Dezember 2010
In diesem Programm lassen sich die Zeichen mit der Mausbewegung auf der X-Achse zusammenrollen. Noch muss die Aktivierung per Mausklick implementiert werden. In den nächsten Schritten werde ich ebenfalls die schon vorhandenen Zeichen durch komplexere und interessante ersetzen und weitere Parameter animierbar (versuchen zu) machen.int anzahl = 7; int rand = 50; boolean changeDirection = true; boolean changeDirection1 = false; float change,change1; float xStep; float yStep; int[] permutationsIndexList = {0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 5, 2, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 2, 5, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 0}; void setup() { size(600, 600); smooth(); xStep = (width - 2 * rand) / (float)(anzahl-1); yStep = (height - 2 * rand) / (float)(anzahl-1); //noLoop(); } void draw() { background(255); int permutationsIndex = 0; pushMatrix(); translate(rand,rand); for(int y=0; y<anzahl;y++) { pushMatrix(); for(int x=0; x<anzahl;x++) { if(changeDirection){ change +=(pmouseX-mouseX)*0.00001; } else { change -=(pmouseX+mouseX)*0.00001; } /*if(changeDirection1){ change1 +=(pmouseY-mouseY)*0.00000001; } else { change1 -=(pmouseY+mouseY)*0.00000001; }*/ drawPermutationObj(permutationsIndexList[permutationsIndex], change, change1); print(str(permutationsIndexList[permutationsIndex]) + "\t"); ++permutationsIndex; translate(xStep,0.0f); } println(); popMatrix(); translate(0.0f,yStep); } popMatrix(); } void drawPermutationObj(int type, float c, float c1) { pushStyle(); switch(type) { case 0: stroke(0); fill(255); rotate(c1*1); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c*1); rect(-30, -30, 60, 60); fill(255); rect(-55/2, -55/2, 55, 55); popMatrix(); break; case 1: stroke(0); fill(255); rotate(c*2); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c*2); rect(-55/2, -55/2, 55, 55); fill(255); rect(-50/2, -50/2, 50, 50); popMatrix(); break; case 2: stroke(0); fill(255); rotate(c1*3); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c*3); rect(-50/2, -50/2, 50, 50); fill(255); rect(-40/2, -40/2, 40, 40); popMatrix(); break; case 3: stroke(0); fill(255); rotate(c*4); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c*4); rect(-45/2, -45/2, 45, 45); fill(255); rect(-30/2, -30/2, 30, 30); popMatrix(); break; case 4: stroke(0); fill(255); rotate(c*5); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c1*5); rect(-40/2, -40/2, 40, 40); fill(255); rect(-20/2, -20/2, 20, 20); popMatrix(); break; case 5: stroke(0); fill(255); rotate(c*6); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c*6); rect(-35/2, -35/2, 35, 35); fill(255); rect(-5/2, -5/2, 5, 5); popMatrix(); break; case 6: stroke(0); fill(255); rotate(c1*7); //rect(-75/2, -75/2, 75, 75); fill(0); pushMatrix(); rotate(c*7); rect(-30/2, -30/2, 30, 30); fill(255); rect(-1, -1, 1, 1); popMatrix(); break; default: break; } popStyle(); } void keyPressed() { switch(key) { case ' ': save("permutation.jpg"); break; case '1': changeDirection = !changeDirection; break; } }