In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

コッホ曲線

再帰的
無駄が多い気がする
Get Adobe Flash player
by Susisu 04 Jan 2011
    Embed
package{
    import flash.display.Sprite;
    public class FlashTest extends Sprite{
        public function FlashTest(){
            addChild(new Curve(465/2));
        }
    }
}
//本体
import flash.display.Sprite;
class Curve extends Sprite{
    public function Curve(x:Number=0,y:Number=0,rotation:Number=0,scale:Number=1,gen:uint=0){
        this.x=x;
        this.y=y;
        this.rotation=rotation;
        this.scaleX=this.scaleY=scale;
        if(gen>=6){
            graphics.lineStyle(0);
            graphics.moveTo(-225,0);
            graphics.lineTo(-75,0);
            graphics.lineTo(0,75*Math.sqrt(3));
            graphics.lineTo(75,0);
            graphics.lineTo(225,0);
        }
        else{
            gen++;
            //なんか自分でも何書いてるかわからなくなってきた
            addChild(new Curve(-150,0,0,1/3,gen));
            addChild(new Curve(-150/4,150/4*Math.sqrt(3),60,1/3,gen));
            addChild(new Curve(150/4,150/4*Math.sqrt(3),-60,1/3,gen));
            addChild(new Curve(150,0,0,1/3,gen));
        }
    }
}