forked from: F5 Tree Sample
processing samplle の アレ F5MovieClipの場合
// forked from nutsu's F5 Tree Sample
// write as3 code here..
// processing samplle の アレ F5MovieClipの場合
package{
import frocessing.display.F5MovieClip2D;
[SWF(frameRate="30", backgroundColor="#000000")]
public class F5TreeSample2 extends F5MovieClip2D
{
private var theta:Number;
public function F5TreeSample2()
{
super();
stroke(255,0.5);
}
public function draw():void
{
var a:Number = (mouseX / stage.stageWidth ) * 90;
var h:Number = 150 - ( mouseY / stage.stageHeight) * 50;
theta = radians(a);
translate(stage.stageWidth*0.5, stage.stageHeight);
line(0, 0, 0, -h);
translate(0, -h);
branch( h*0.9 );
}
private function branch( h:Number ):void
{
h *= 0.66;
if (h > 2)
{
pushMatrix();
rotate(theta);
line(0, 0, 0, -h);
translate(0, -h);
branch(h);
popMatrix();
pushMatrix();
rotate(-theta);
line(0, 0, 0, -h);
translate(0, -h);
branch(h);
popMatrix();
}
}
}
}