In Processing.js:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 
//Info: http://processingjs.org/reference
 
void setup() {
 
	size(404,730);
 
	int rows = 22;
 
	int cols = 12;
 
	int count = cols * rows;
 
	int rect_width = 384 / cols;
 
	int rect_height = rect_width;
 
 
 
smooth();
 
translate(10,10);
 
background(#ffffff);
 
noFill();
 
 
 
	for (int ii = 0; ii < count; ii ++){
 
		int origin_x = (ii%cols) * rect_width;
 
		int origin_y = floor(ii / cols) * rect_height;
 
		float randomness = ((float)ii / (float)count);
 
		float rand_rad = (random(2) - 1) * randomness * randomness;
 
		float rand_x = (random(8) - 4) * randomness * randomness;
 
		float rand_y = (random(8) - 4) * randomness * randomness; 
 
		translate(origin_x, origin_y);
 
		rotate(rand_rad);
 
		rect(rand_x, rand_y, rect_width, rect_height);
 
		rotate(-rand_rad);
 
		translate(-origin_x, -origin_y);
 
	}
 
}
 
void draw() {
 
}

As a Java applet:

As code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 
size(404,730);
 
 
 
int rows = 22;
 
int cols = 12;
 
int count = cols * rows;
 
int rect_width = 384 / cols;
 
int rect_height = rect_width;
 
 
 
smooth();
 
translate(10,10);
 
background(#ffffff);
 
noFill();
 
 
 
for (int ii = 0; ii < count; ii ++){
 
  int origin_x = (ii%cols) * rect_width;
 
  int origin_y = floor(ii / cols) * rect_height;
 
 
 
  float randomness = ((float)ii / (float)count);
 
  float rand_rad = (random(2f) - 1f) * randomness * randomness;
 
  float rand_x = (random(8f) - 4f) * randomness * randomness;
 
  float rand_y = (random(8f) - 4f) * randomness * randomness; 
 
  translate(origin_x, origin_y);
 
  rotate(rand_rad);
 
  rect(rand_x, rand_y, rect_width, rect_height);
 
  rotate(-rand_rad);
 
  translate(-origin_x, -origin_y);
 
}

A video demonstrating it done in OpenFrameworks as well: