Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- size(400, 400);
- art(1, 1, 400, 400, N);
- }
- void draw() {
- }
- int N = 2;
- void art(int x0, int y0, int x1, int y1, int N) {
- if (N == 0) {
- int sw = 3;
- color c[] = { #ff0000, #00ff00, #0000ff, #ffff00, #ffffff}; //Mondarian color palatte
- fill(c[int(random(c.length))]);
- strokeWeight(sw);
- rect (x0, y0, x1-x0-sw, y1-y0-sw);
- } else {
- int i = int(random(x0, x1));
- int j = int(random(y0, y1));
- art(x0, y0, i, j, N-1);
- art(i, y0, x1, j, N-1);
- art(x0, j, i, y1, N-1);
- art(i, j, x1, y1, N-1);
- }
- }
- void keyPressed() {
- art(1, 1, 400, 400, N );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement