-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPollockParticle.pde
More file actions
61 lines (57 loc) · 2.62 KB
/
PollockParticle.pde
File metadata and controls
61 lines (57 loc) · 2.62 KB
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
public class PollockParticle{
private float px, py;
private int NUM = 500;
private color col;
private float radius;
private PollockParticle [] particle = new PollockParticle [NUM];
public PollockParticle(float x,float y/*, PollockParticles [] particles*/){
this.px = x;
this.py = y;
//this.particle = particles;
}
void appear(){
noStroke();
fill(this.col);
ellipse(this.px,this.py,this.radius,this.radius);
}
void active() {
for(int j = 0; j<5;j++){
for(int i = 0; i< this.NUM; i++){
if(this.px < width/2 && this.py <height/2){this.col = color (255,random(0,150),random(0,150));};
if(this.px > width/2 && this.py <height/2){this.col = color (random(0,150),255,random(0,150));};
if(this.px < width/2 && this.py >height/2){this.col = color (random(0,150),random(0,150),255);};
if(this.px > width/2 && this.py > height/2){this.col = color (random(0,255),random(0,255),random(0,255));};
float divX = random(-900,900);
float divY = random(-900,900);
float distance = sqrt(divX*divX+divY*divY);
this.radius = 60* exp(-distance*0.03);
particle[i] = new PollockParticle(this.px+divX, this.py+divY);
particle[i].appear();
}
for(int i = 0; i< NUM; i++){
if(this.px < width/2 && this.py <height/2){this.col = color (255,random(0,150),random(0,150));};
if(this.px > width/2 && this.py <height/2){this.col = color (random(0,150),255,random(0,150));};
if(this.px < width/2 && this.py >height/2){this.col = color (random(0,150),random(0,150),255);};
if(this.px > width/2 && this.py > height/2){this.col = color (random(0,255),random(0,255),random(0,255));};
float divX = random(-600,600);
float divY = random(-600,600);
float distance = sqrt(divX*divX+divY*divY);
this.radius = 60* exp(-distance*0.06);
particle[i] = new PollockParticle(this.px+divX, this.py+divY);
particle[i].appear();
}
for(int i = 0; i< NUM; i++){
if(this.px < width/2 && this.py <height/2){this.col = color (255,random(0,150),random(0,150));};
if(this.px > width/2 && this.py <height/2){this.col = color (random(0,150),255,random(0,150));};
if(this.px < width/2 && this.py >height/2){this.col = color (random(0,150),random(0,150),255);};
if(this.px > width/2 && this.py > height/2){this.col = color (random(0,255),random(0,255),random(0,255));};
float divX = random(-300,300);
float divY = random(-300,300);
float distance = sqrt(divX*divX+divY*divY);
this.radius = 60* exp(-distance*0.12);
particle[i] = new PollockParticle(this.px+divX, this.py+divY);
particle[i].appear();
}
}
}
}