import processing.pdf.*; ArrayList bezies; int sat = 65; color base, back, backTrans, eraser; float increment = 0.05f, xoff = 0.0f; void setup() { size(300, 300); back = color(255); backTrans = color(255, 40); eraser = color(255, 75); background(back); bezies = new ArrayList(100); colorMode(HSB, 360, 100, 100, 100); noFill(); smooth(); base = color(222, sat, 85, 85); frameRate(100); beginRecord(PDF, "everything.pdf"); } void draw() { color c = color(222, int(random(sat-10, sat)), 87);//, int(random(10, 80))); if (frameCount % 200 == 0) { fill(backTrans); rect(0, 0, width, height); noFill(); } if (bezies.isEmpty()) { Bez b = makeNewBez(50); bezies.add(b); strokeWeight(1.0); stroke(c); bezier(b.x1, b.y1, b.cx1, b.cy1, b.cx2, b.cy2, b.x2, b.y2); b = makeNewBez(150); bezier(b.x1, b.y1, b.cx1, b.cy1, b.cx2, b.cy2, b.x2, b.y2); b = makeNewBez(200); bezier(b.x1, b.y1, b.cx1, b.cy1, b.cx2, b.cy2, b.x2, b.y2); } else { if (random(0, 1) < 0.003) { Bez b = makeNewBez(); bezies.add(b); strokeWeight(1.0); stroke(c); bezier(b.x1, b.y1, b.cx1, b.cy1, b.cx2, b.cy2, b.x2, b.y2); } else { int i = int(random(0, bezies.size())); Bez b = (Bez)bezies.get(i); if (b.add()) bezies.add(b); strokeWeight(b.sw); if (random(0, 1) < 0.10) { //strokeWeight(1.0); /*if (random(0, 1) < 0.5)*/ c = color(54, 93, 75, 85); //else c = color(144, 37, 87); } else if (random(0, 1) < 0.30) { strokeWeight(2.0); c = eraser; } stroke(c); bezier(disturb(b.x1, b.dx1), disturb(b.y1, b.dy1), disturb(b.cx1, b.dc1x), disturb(b.cy1, b.dc1y), disturb(b.cx2, b.dc2x), disturb(b.cy2, b.dc2y), disturb(b.x2, b.dx2), disturb(b.y2, b.dy2)); } } } void mousePressed() { if (key == 'q') { endRecord(); exit(); } } int disturb(int base, int margin) { int m = 1; if (random(0, 1) < 0.5) m = -1; return base + m*int(random(0, margin)); } float noisy(float coord, float mn, float mx) { return noise(coord)*(mx-mn) + mn; } Bez makeNewBez(int w) { /*if (random(0, 1) < 0.2) { w = w < 0 ? int(noisy(xoff, 0.0f, (float)width)) : w; xoff += increment; if (xoff > 1) xoff = 0.0f; } else {*/ w = w < 0 ? int(random(0, width)) : w; //} int cx1 = disturb(w, 35); int cy1 = height/4; int cx2 = disturb(w, 35); int cy2 = 3*height/4; cx1 = disturb(cx1, 25); cx2 = disturb(cx2, 25); cx1 = cx1 < 0 ? 0 : cx1 > width ? width : cx1; cx2 = cx2 < 0 ? 0 : cx2 > width ? width : cx2; Bez b = new Bez(w, disturb(0, 60), cx1, cy1, cx2, cy2, w, height); b.dx1 = int(random(1, 3)); b.dy1 = int(random(9, 15)); b.dc1x = int(random(1, 3)); b.dc1y = int(random(7, 13)); b.dc2x = int(random(5, 9)); b.dc2y = int(random(14, 23)); b.dx2 = int(random(1, 4)); b.dy2 = int(random(6, 10)); b.sw = (float)disturb(3, 2); return b; } Bez makeNewBez() { return makeNewBez(-1); } class Bez { public int x1, y1, cx1, cy1, cx2, cy2, x2, y2; public int dx1, dy1, dc1x, dc1y, dc2x, dc2y, dx2, dy2; public float sw; int count; public Bez(int x1, int y1, int cx1, int cy1, int cx2, int cy2, int x2, int y2) { this.x1=x1; this.y1=y1; this.cx1=cx1; this.cy1=cy1; this.cx2=cx2; this.cy2=cy2; this.x2=x2; this.y2=y2; count = 1; } boolean add() { float s0 = sqrt(count); count++; float s1 = sqrt(count); return (floor(s1) - floor(s0) > 0); } }