void setup() { size(1280, 720); colorMode(HSB, 360, 100, 100); background(116, 97, 26); noStroke(); // stroke(0,0,0); } void draw() { if (mousePressed) { romanesco(mouseX, mouseY, random(200,500), random(0, 360), random(80, 100), random(70, 100), random(20, 35)); } if (keyPressed) { if (key == 'c' || key == 'C' || key == DELETE || key == BACKSPACE) background(116, 97, 26); if (key == 's' || key == 'S') saveFrame("screenshot.png"); } } void romanesco(float x, float y, float size, float deg, float hue, float sat, float bri) { int ct = 12; float rsize = size * 0.25; pushMatrix(); translate(x, y); rotate(deg*TWO_PI/360); fill(hue, sat, bri); float rad = 0.0; float drad = TWO_PI / ct; float sz = size; float briPlus = 0; if (size >= 5) { for (int i = 0; i < ct; i++) { float rt = sz-rsize; int m = i % 4; if (m == 2) rt *= 0.90; else if (m == 1 || m == 3) rt *= 0.95; if (i == 0) briPlus= 10; else if (i == 1 || i == 11) briPlus= 8; else if (i == 2 || i == 10) briPlus= 5; else if (i >= 5 && i <= 7) briPlus = -5; else briPlus = 0; // ellipse((sz-rsize) * cos(rad), (sz-rsize) * sin(rad), 2*rsize, 2*rsize); romanesco(rt * cos(rad), rt * sin(rad), rsize , deg-30*i, hue, sat, bri+briPlus); // rsize *= 0.993; sz *= 0.99; rad -= drad; } popMatrix(); // romanesco(x, y, size * 0.70 , deg+9, hue*0.95, sat, bri*1.2); romanesco(x, y, size * 0.70 , (deg+9)*1.2, hue*0.96, sat, bri*1.2); } else { size += 1; triangle(0, size, 1.732*size/2, -size+2/2, -1.732*size/2, -size/2); // ellipse(0, 0, size*2, size*2); popMatrix(); } }