-
Notifications
You must be signed in to change notification settings - Fork 74
/
ringsCleaner.pde
72 lines (70 loc) · 1.35 KB
/
ringsCleaner.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
Simple rings made out of circles.
A better idea would be using a PShape and adding vertices.
I wonder if that can also be done with translate() and rotate()
by tilting flat rings.
*/
Ring a, b, c;
int delay = 100;
void setup() {
size(400, 400);
noStroke();
colorMode(HSB);
background(0);
a = new Ring(0, 50, 100, 50, #FFFF00);
b = new Ring(TWO_PI / 3, 50, 100, 50, #FF00FF);
c = new Ring(2 * TWO_PI / 3, 50, 100, 50, #00FFFF);
}
void draw() {
float an = frameCount * 0.01;
if (an < PI) {
a.draw(an);
b.draw(an);
c.draw(an);
an += PI;
a.draw(an);
b.draw(an);
c.draw(an);
}
else {
if(--delay > 0) {
return;
}
/*
PImage i = get();
filter(BLUR, 8);
blendMode(ADD);
image(i, 0, 0);
noLoop();
*/
filter(ERODE);
filter(BLUR, 2);
filter(POSTERIZE, 2);
}
}
void keyPressed() {
if(key == 's') {
save("thumb.jpg");
}
}
class Ring {
float angle, dist, radius, wi;
int c;
Ring(float angle, float dist, float radius, float wi, int c) {
this.angle = angle;
this.dist = dist;
this.radius = radius;
this.wi = wi;
this.c = c;
}
void draw(float ang) {
fill(c);
pushMatrix();
translate(width/2, height/2);
rotate(angle);
translate(dist, 0);
rotate(ang);
ellipse(radius, 0, wi, wi);
popMatrix();
}
}