xxxxxxxxxx
int tentaclNum = 4;
int tentaclGroupsNum = 8;
Tentacles [] tentacles = new Tentacles[tentaclGroupsNum];
float ghost = 100;
void setup () {
size(800, 800);
colorMode(HSB, 360, 100, 100, 100);
background(0);
for (int i = 0; i < tentacles.length; i++) {
tentacles [i] = new Tentacles(-width/2, -height/2, PI/2.5, random(170,220));
}
}
void draw () {
noStroke();
fill(0, ghost);
rect(0, 0, width, height);
translate(width/2, height/2);
for (int i = 0; i < tentacles.length; i++) {
rotate(PI/(tentaclGroupsNum/2));
tentacles [i] .run();
}
}
//----------------------------------------------
class Tentacles {
Tentacle [] tentacle = new Tentacle[tentaclNum];
PVector location;
float angle;
float hue;
Tentacles (float _x, float _y, float _angle, float _hue) {
location = new PVector(_x, _y);
angle = _angle;
hue = _hue;
for (int i = 0; i < tentacle.length; i++) {
tentacle [i] = new Tentacle(_hue);
}
}
void run () {
pushMatrix();
translate(location.x, location.y);
rotate(angle);
for (int i = 0; i < tentacle.length; i++) {
rotate(PI/10);
tentacle[i].run();
}
popMatrix();
}
}
//----------------------------------------------
class Tentacle {
float theta, thetaRate;
float wiggle;
float size;
float hue;
Tentacle (float _hue) {
thetaRate = (int)random(50, 200);
size = (int)random(10, 45);
hue = _hue;
}
void run () {
theta += PI/thetaRate;
display(-size, PI/20, 0, 0);
}
void display (float y, float amp, float thetaStart, float wiggle) {
wiggle = 8*sin(theta+thetaStart);
strokeWeight(abs(y)+abs(wiggle));
stroke(hue, 70, -y*2);
line(0, 0, 0, y);
if (y < 0) {
pushMatrix();
translate(0, y);
//rotate(wiggle/50);
rotate(wiggle/50);
display(y+size/30, amp+1, thetaStart-0.1, wiggle);
popMatrix();
}
}
}