xxxxxxxxxx
float xoff;
void setup(){
size(640, 640);
stroke(0, 150, 255, 100);
}
void draw(){
background(0);
translate(width/2, height - 60);
branch(160);
}
void branch(float len){
float t = map(len, 1, 160, 1, 30);
float angle = sin(radians(xoff+len)) * 5;
float theta = mouseX - width/2;
strokeWeight(t);
fill(0, 150, 255, 100);
bezier(0, 0, 0, 0, -t*2, -t*2, 0, -len);
bezier(0, 0, 0, 0, t*2, -t*2, 0, -len);
fill(255);
ellipse(0, 0, t, t);
translate(0, -len);
if(len > 5){
pushMatrix();
rotate(radians(theta+angle));
branch(len * 0.618);
popMatrix();
pushMatrix();
rotate(radians(-theta+angle));
branch(len * 0.618);
popMatrix();
}
xoff += 0.005;
}