/
Tentacle.pde
73 lines (66 loc) · 1.48 KB
/
Tentacle.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
class Tentacle
{
float xpos;
int divisions;
int RADIUS_MAX = (int) random(10, 20);
int RADIUS_MIN = RADIUS_MAX/2;
float speed = 0.0;
float speedInc = random(0.01, 0.1);
float angle = 0;
int MIN_XPOS;
int MAX_XPOS;
PImage orb;
Tentacle(float $xpos, int $divisions, int $MIN_XPOS, int $MAX_XPOS)
{
xpos = $xpos;
MIN_XPOS = $MIN_XPOS;
MAX_XPOS = $MAX_XPOS;
divisions = $divisions;
orb = loadImage("orb.png");
}
void draw()
{
//angle = sin(speed)/random(10.0, 50.0) + sin(speed*1.2)/random(5.0, 20.0);
pushMatrix();
translate(xpos, height);
for (int i = divisions; i > 0; i--) {
//stroke(130, 126, 0, 150);
stroke(255, 255, 255, 80);
line(0, 0, 0, -i);
//strokeWeight(i);
//noStroke();
//fill(255, 255, 255, 50);
fill(0, 50);
//stroke(255, 50);
noStroke();
imageMode(CENTER);
image(redOrb, 0, RADIUS_MAX, i*2, i*2);
image(greenOrb, 0, RADIUS_MAX, i*1.5, i*1.5);
image(whiteOrb, 0, RADIUS_MAX, i, i);
//image(blueOrb, 0, RADIUS_MAX, i, i);
//image(orb, 0, RADIUS_MAX, i, i);
ellipse(0, RADIUS_MAX, i, i);
fill(255, 255, 255, 50);
ellipse(0, RADIUS_MAX, i/2, i/2);
translate(0, - i );
rotate(angle);
}
popMatrix();
}
void move()
{
speed += speedInc;
angle = sin(speed)/random(20.0, 50.0) + sin(speed*1.2)/random(5.0, 20.0);
draw();
}
void stop()
{
speed += 0.01;
angle = sin(speed)/50.0 + sin(speed*1.2)/20.0;
draw();
}
void changePosition()
{
xpos = random(MIN_XPOS, MAX_XPOS);
}
}