-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloud.pde
76 lines (64 loc) · 1.79 KB
/
cloud.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
73
74
75
76
class Cloud{
int x;
int y;
float r;
float fontscale;
String word;
float currentmeshpointX;
float currentmeshpointY;
Cloud(int x, int y, float r, float fontscale,String word){
this.x = x;
this.y = y;
this.word = word;
stroke(0);
this.r = r;
this.fontscale = fontscale;
}
void render(){
RCommand.setSegmentLength(15);
RGroup grp = font.toGroup(word);
grp.translate(x,y);
grp.scale(fontscale);
grp.rotate(r);
RShape grpshape = grp.toShape();
grp = grp.toPolygonGroup();
RPoint[] clouddust = grp.getPoints();
// RCommand.setSegmentLength(mouseX/2+6);
/*for (int i=0; i < clouddust.length; i++) {
if (i%25 == 0) {
noStroke();
fill(128,128);
rect(clouddust[i].x-35,clouddust[i].y-35,70,70);
}
}
*/
stroke(255,0,100,50);
//fill(255,0,100);
noFill();
//currentmeshpoint.x = clouddust[0].x + random(-20,20);
beginShape(TRIANGLE_STRIP);
for (int i=0; i < clouddust.length; i++) {
vertex(clouddust[i].x, clouddust[i].y);
if (i%5 == 0) {
currentmeshpointX = clouddust[i].x + noise(i*0.04)*fontsize;
if (clouddust[i].y + fontsize > fontsize/2) {
currentmeshpointY = clouddust[i].y + noise(i*0.02)*fontsize;
} else {
currentmeshpointY = clouddust[i].y - noise(i*0.02)*fontsize;
// println(clouddust[i].y);
}
}
vertex(currentmeshpointX, currentmeshpointY);
//rect(clouddust[i].x, clouddust[i].y,20, 20);
}
endShape();
noStroke();
fill(255);
// RCommand.setSegmentLength(1);
fill(255,255,255,128);
stroke(0);
// for (int i=0; i < clouddust.length; i++) {
// ellipse(clouddust[i].x, clouddust[i].y,5, 5);
// }
}
}