-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom_circles.pde
58 lines (43 loc) · 1.53 KB
/
random_circles.pde
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
import ddf.minim.*;
boolean changed = true;
int secondChanges = 7;
movingCircle toRightCircle;
movingCircle toLeftCircle;
movingCircle toUpCircle;
movingCircle toDownCircle;
void setup() {
size(1280, 720);
toRightCircle = new movingCircle(width/2, height/2, width/6, 1, #ffffff, 150, 1);
toLeftCircle = new movingCircle(width/2, height/2, width/6, -1, #ffffff, 150, 1);
toUpCircle = new movingCircle(width/2, height/2, height/6, 1, #ffffff,70, -1);
toDownCircle = new movingCircle(width/2, height/2, height/6, -1, #ffffff, 70, -1);
randomSeed(12);
}
void draw() {
if(floor(millis()/1000) % secondChanges > 0) {
changed = true;
}
if(changed && floor(millis()/1000) % secondChanges == 0) {
changed = !changed;
//fixed Y, random X
int randomX = (int)random(width/6, height-width/6);
toRightCircle = new movingCircle(randomX, height/2, width/6, 1, #ffffff, 150, 1);
toLeftCircle = new movingCircle(width-randomX, height/2, width/6, -1, #ffffff, 150, 1);
//random Y, fixed X
int randomY = (int)random(width/6, height-width/6);
toUpCircle = new movingCircle(width/2, randomY, height/6, 1, #ffffff,70, -1);
toDownCircle = new movingCircle(width/2, height-randomY, height/6, -1, #ffffff, 70, -1);
}
background(0);
toRightCircle.display();
toRightCircle.move();
toLeftCircle.display();
toLeftCircle.move();
toUpCircle.display();
toUpCircle.move();
toDownCircle.display();
toDownCircle.move();
}
void mousePressed() {
saveFrame("output/eminsphere_#####.png");
}