void setup() { size(500, 500); background(255); smooth(); noFill(); noLoop(); ellipseMode(RADIUS); } void draw() { rule1(width / 2, height / 2, 400); blend(createCircleMask(200), 0, 0, width, height, 0, 0, width, height, ADD); } void rule1(float x, float y, float r) { if (r < 25) { return; } strokeWeight(r / 100); ellipse(x, y, r, r); float hr = r / 2; rule1(x, y, hr); for (int t = 30; t < 360 + 30; t += 60) { float c = hr * cos(radians(t)); float s = hr * sin(radians(t)); rule1(x + c, y + s, hr); } } PGraphics createCircleMask(float r) { PGraphics mask = createGraphics(width, height); mask.beginDraw(); mask.background(255); mask.noStroke(); mask.fill(0); mask.ellipseMode(RADIUS); mask.ellipse(width / 2, height / 2, r, r); mask.endDraw(); return mask; }
|