-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeRigoloSemaine1.pde
More file actions
52 lines (38 loc) · 850 Bytes
/
CodeRigoloSemaine1.pde
File metadata and controls
52 lines (38 loc) · 850 Bytes
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
boolean isMoving = true;
void settings(){
size(400,800,P2D);
}
void setup(){
background(255,192,203);
noLoop();
}
void draw(){
plant(15,0.4,0.8);
}
void leaf(){
noStroke();
fill(0, 255,0);
beginShape();
vertex(100.0,-70.0);
bezierVertex(90.0,-60.0,40.0,-100.0,0.0,0.0);
bezierVertex(0.0,0.0,100.0,40.0,100.0,-70.0);
endShape();
}
void plant(int numLeaves, float minLeafScale, float maxLeafScale){
int gap = height/numLeaves;
float angle = 0;
for(int i=0; i<numLeaves; i++){
int x = width/2;
int y = gap*i + (int)random(gap);
float scale = random(minLeafScale, maxLeafScale);
pushMatrix();
translate(x,y);
rotate(angle);
scale(scale);
leaf();
popMatrix();
angle += PI;
}
stroke(0,200,0);
line(width/2,0, width/2, height);
}