21. Oktober 2011
Pattern 1
import processing.pdf.*; int gridSpacing = 50; int pointSize = 10; void setup() { //size(600,600,PDF,"ornament.pdf"); // def. fenstergroesse size(700, 700); smooth(); // aktiviere antialiasing strokeWeight(2); // linienbreite } void draw() { background(255); // def. hintergrundfarbe pattern(); // funtions aufruf //exit(); } // funktion void pattern() { for(int x = 0; x for(int y = 0; y pushStyle(); fill(0); noStroke(); ellipse(x, y, pointSize, pointSize); popStyle(); pushMatrix(); noFill(); translate(x, y); for(int i = 0; i stroke(255 - i * 5); arc(0 + i, 0 + i, gridSpacing - i, gridSpacing - i, 0, radians(270)); } popMatrix(); } } }
Pattern 2
import processing.pdf.*; int gridSpacing = 50; int pointSize = 10; void setup() { //size(600,600,PDF,"ornament.pdf"); // def. fenstergroesse size(700, 700); smooth(); // aktiviere antialiasing strokeWeight(2); // linienbreite randomSeed(millis()); noLoop(); } void keyPressed() { redraw(); } void draw() { background(255); // def. hintergrundfarbe pattern(); // funtions aufruf //exit(); } // funktion void pattern() { for(int x = 0; x <= width; x += gridSpacing) { for(int y = 0; y <= height; y+= gridSpacing) { float mouseline = dist(width / 2, height / 2, mouseX, mouseY); int by; if (mouseY >= height / 2) by = mouseY - height / 2; else by = height / 2 - mouseY; float basicline = dist(width / 2, height / 2, mouseX, by); float angle = (float) Math.acos(basicline / mouseline); println(angle); angle = random(360); float scaled = random (0.1, 3); pushMatrix(); noFill(); translate(x, y); //rotate(angle); //scale(scaled); for(int i = 0; i <= gridSpacing; i++) { stroke(255 - i * 4, x % 255 - i * 4, y % 255 - i * 4, 150); arc(0 + i, 0 - i, gridSpacing - i, gridSpacing - i, 0, 270); } popMatrix(); pushStyle(); fill(0, 50); noStroke(); ellipse(x, y, pointSize, pointSize); popStyle(); /* pushStyle(); fill(255); noStroke(); rect(0, 0, gridSpacing, height); rect(0, 0, width, gridSpacing); rect(width - gridSpacing, 0, width, height); rect(0, height - gridSpacing, width, height); popStyle(); pushMatrix(); noFill(); translate(x, 0); rotate(180); for(int i = 0; i <= gridSpacing; i++) { stroke(255 - i * 4, x % 255 - i * 4, y % 255 - i * 4, 150); arc(0 + i, 0 - i, gridSpacing - i, gridSpacing - i, 0, 360); } popMatrix();*/ } } }No-pattern mode:
Pattern 3
Experiments with Bezier Curves and points.
import processing.pdf.*; int gridSpacing = 50; int pointSize = 5; void setup() { //size(600,600,PDF,"ornament.pdf"); // def. fenstergroesse size(700, 700); smooth(); // aktiviere antialiasing strokeWeight(1); // linienbreite } void draw() { background(255); // def. hintergrundfarbe pattern(); // funtions aufruf //exit(); } void keyPressed() { } // funktion void pattern() { float divergence = 0; for(int x = 0; x <= width; x += gridSpacing) { for(int y = 0; y <= height; y+= gridSpacing) { /*int ynew = (y % (height / 2)); if(y > (height / 2) && ynew == 0) ynew = height / 2; if(y > (height / 2)) ynew = ynew - height / 2; int xnew = (y % (width / 2)); if(y > (width / 2) && xnew == 0) xnew = width / 2; if(y > (width / 2)) xnew = xnew - width / 2; println(xnew);*/ int xnew = 0; int ynew = 0; pushStyle(); fill(0); noStroke(); ellipse(x + xnew * 0.1, y + divergence + ynew * 0.1, pointSize, pointSize); popStyle(); pushMatrix(); noFill(); translate(x, y); int radius1 = 0; int radius2 = 0; int divergenceOpposite = 0; if(divergence % gridSpacing == 0) { radius1 = 230; radius2 = 360; divergenceOpposite = gridSpacing / 2; } else { radius2 = 130; divergenceOpposite = 0; } bezier(0, 0 + divergence, gridSpacing / 2, gridSpacing / 2 - divergenceOpposite, gridSpacing / 2, gridSpacing / 2 - divergenceOpposite, gridSpacing, gridSpacing - divergenceOpposite); //arc(-(gridSpacing / 2) - 1 + xnew * 0.1, -(divergence) - 1 + ynew * 0.1, gridSpacing / 2, gridSpacing, radians(radius1 - 90), radians(radius2 - 90)); //arc(-(gridSpacing / 2) - 1 + xnew * 0.1, -(divergence) - 1 + ynew * 0.1, gridSpacing, gridSpacing / 2, radians(radius1), radians(radius2)); popMatrix(); } divergence = (divergence + gridSpacing / 2) % (gridSpacing); } }