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

chrysanthemum

Get Adobe Flash player
by mari 24 Jan 2009
package {
  import flash.display.*;
  import flash.events.TimerEvent;
  import flash.filters.GlowFilter;
  import flash.geom.Point;
  import flash.utils.Timer;

  [SWF(width = "400", height = "400", backgroundColor = "#000000", frameRate = "12")]

  public class Test extends Sprite {
    private var chrysanthemum:Shape;
    private var pt:Point;
    private var v:Array;
    private var i:int = 0;

    public function Test():void {
      chrysanthemum = new Shape();
      chrysanthemum.x = stage.stageWidth/2;
      chrysanthemum.y = stage.stageHeight/2;
      pt = new Point();
      v = new Array();
      this.addChild(chrysanthemum);
      // キクの花
      var N:int = 2000;
      var u:Number = 0.0, r:Number = 0.0, p4:Number = 0.0, p8:Number = 0.0;
      for(var i:int=0; i<=N; i++) {
        u = i*21.0*Math.PI/N;
        p4 = Math.sin(17*u/3);
        p8 = Math.sin(2*Math.cos(3*u) - 28*u);
        r = 5*(1 + Math.sin(11*u/5)) - 4*Math.pow(p4, 4)*Math.pow(p8, 8);
        pt.x = r*Math.cos(u)*20;
        pt.y = r*Math.sin(u)*20;
        v.push(pt.clone());
      }
      chrysanthemum.graphics.lineStyle(1, 0xffffff, 0.2);
      chrysanthemum.graphics.moveTo(v[0].x, v[0].y);
      chrysanthemum.filters = [new GlowFilter(0xffff00)];
      for(var j:int=0; j<v.length; j++)
        chrysanthemum.graphics.lineTo(v[j].x, v[j].y);
      chrysanthemum.graphics.lineStyle(2, 0xffffff);
      var timer:Timer = new Timer(20);
      timer.addEventListener(TimerEvent.TIMER, timerHandler);
      timer.start();
    }
    private function timerHandler(e:TimerEvent):void {
      chrysanthemum.rotation++;
      if(i+1<v.length) {
        chrysanthemum.graphics.lineTo(v[i].x, v[i].y);
        i++;
      }
    }
  }
}