20. Oktober 2011
Patterns Stage 1 It was born out of a simple module a square with a fading perspective, using different color fills, using the beginShape tool. Stage 2 With square as a module, i used it to create a pattern. It was like filling the four quadrants of an invisible cartesian plane, with the square-like modules. It begins by translating the central point, and setting up the parameters, in which the form is going to be placed again and again. While doing the pattern exercise, we also learned how to automatically make a PDF of the programmed response and save it in an existing folder. This is how it looked like. Stage 3 Then i played a little with the color of the fills, of the respecting shapes in which it was composed. And played with the quadrants, changing the parameters. Stage 4 Finally i wanted to maintain the pattern, keep the color experimentation, and have a little bit of interaction. So i used the switch key. Using the "B" for blue and the "M" for magenta. And thats what i did with patterns! Here are the codes for each stage: Stage 1:size(400,400); // def. fenstergroesse background(255); // def. hintergrundfarbe smooth(); // aktiviere antialiasing stroke(0); fill(255); smooth(); beginShape(); vertex(0,30); vertex(30,30); vertex(30,60); vertex(0,60); endShape(CLOSE); stroke(98); fill(51,52,59); smooth(); beginShape(); vertex(30,60); vertex(80,0); vertex(30,30); endShape(CLOSE); stroke(98); fill(79,170,169); smooth(); beginShape(); vertex(0,30); vertex(80,0); vertex(30,30); endShape(CLOSE);Stage 2:
import processing.pdf.*; void setup() { size(800,800,PDF,"ornamentAD8.pdf"); // def. fenstergroesse smooth(); strokeWeight(1); } void draw() { background(255); for(int x=0; x <=width; x=40) { for(int y = 0; y <= height; y+=40) { pushMatrix(); translate(x,y); scale(.8); module(); popMatrix(); } } exit(); } //funktion void module() { stroke(0); fill(255); smooth(); beginShape(); vertex(0,30); vertex(30,30); vertex(30,60); vertex(0,60); endShape(CLOSE); { stroke(98); fill(79,170,169); smooth(); beginShape(); vertex(30,60); vertex(80,0); vertex(30,30); endShape(CLOSE); { stroke(98); fill(0); smooth(); beginShape(); vertex(0,30); vertex(80,0); vertex(30,30); endShape(CLOSE); } } }Stage 4
static final int MODULE1 = 1<<0; static final int MODULE2 = 1<<1; int moduletype = MODULE1; void setup() { size(800,800); // def. fenstergroesse smooth(); strokeWeight(1); } void draw() { background(255); for(int x = 0; x <= width; x+=40) { for(int y = 0; y <= height; y+=40) { pushMatrix(); translate(x,y); module(moduletype); scale(1); //rotate(radians(45)); popMatrix(); } } } void keyPressed() { switch(key) { case 'b': moduletype = MODULE1; break; case 'm': moduletype = MODULE2; break; } } //funktion void module(int moduletype) { smooth(); { if((moduletype & MODULE1) > 0) stroke(0); fill(0); beginShape(); vertex(0,30); vertex(30,30); vertex(30,60); vertex(0,60); endShape(CLOSE); stroke(98); fill(77,167,255); smooth(); beginShape(); vertex(30,60); vertex(80,0); vertex(30,30); endShape(CLOSE); stroke(98); fill(77,167,255); smooth(); beginShape(); vertex(0,30); vertex(80,0); vertex(30,30); endShape(CLOSE); } if((moduletype & MODULE2) != 0) { { stroke(0); fill(255); beginShape(); vertex(0,30); vertex(30,30); vertex(30,60); vertex(0,60); endShape(CLOSE);} { stroke(98); fill(211,81,194); smooth(); beginShape(); vertex(30,60); vertex(80,0); vertex(30,30); endShape(CLOSE);} { stroke(98); fill(0); smooth(); beginShape(); vertex(0,30); vertex(80,0); vertex(30,30); endShape(CLOSE); } } }