-
Notifications
You must be signed in to change notification settings - Fork 1
/
sketch.js
69 lines (54 loc) · 1.42 KB
/
sketch.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
61
62
63
64
65
66
67
68
69
var n = 29; //change for number of pics
var imgMask = [n];
var img = [n];
var imgR1, imgR2, imgR3, imgR4, imgR5;
var angle = 0;
var r1, r2, r3, r4, r5;
function preload() {
for (var i = 0; i <= n; i++) {
img[i] = loadImage("imgs/" + i + ".png");
}
for (var j = 0; j <= n; j++) {
imgMask[j] = loadImage("imgs/" + j + ".png");
}
}
function setup() {
//createCanvas(1024, 648);
createCanvas(windowWidth, windowHeight);
imgR1 = int(random(n));
imgR2 = int(random(n));
imgR3 = int(random(n));
imgR4 = int(random(n));
imgR5 = int(random(n));
img[imgR1].mask(imgMask[int(random(n))]);
img[imgR2].mask(imgMask[int(random(n))]);
img[imgR3].mask(imgMask[int(random(n))]);
img[imgR4].mask(imgMask[int(random(n))]);
img[imgR5].mask(imgMask[int(random(n))]);
imageMode(CENTER);
r1 = random(-1.2, 1.2);
r2 = random(-1.2, 1.2);
r3 = random(-1.2, 1.2);
r4 = random(-1.2, 1.2);
r5 = random(-1.2, 1.2);
}
function draw() {
//background(100, 100);
translate(width / 2, height / 2);
var w = (width * 1.5);
var h = (width * 1.5);
rotate(radians(angle*r1));
image(img[imgR1], 0, 0, w, h);
rotate(radians(angle*r2));
image(img[imgR2], 0, 0, w, h);
rotate(radians(angle*r3));
image(img[imgR3], 0, 0, w, h);
rotate(radians(angle*r4));
image(img[imgR4], 0, 0, w, h);
//rotate(radians(angle*r5));
//image(img[imgR5], 0, 0, w, h);
angle++;
}
function mousePressed() {
setup();
}