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

Drawing Actinia

Get Adobe Flash player
by utabi 20 Aug 2009
/**
 * Copyright utabi ( http://wonderfl.net/user/utabi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/37Nl
 */

package {
  import flash.geom.Point;
  import frocessing.display.*;
  
  [SWF(width="465", height="465", frameRate="60")]
  
  public class Actinia extends F5MovieClip2DBmp{
    
    private var stage_width:Number  = 465;
    private var stage_height:Number = 465;
    private var t:Number = 55;
    private var division:int = 12;
    private var innerRadius:int = 80;
    private var spreading:int = 8;
    
    public function Actinia() {
      super();
    }
    
    public function setup():void {
      size( stage_width, stage_height );
      background( 0 );
      //noFill();
      stroke( 255, .5 );
    }
    
    public function draw():void {
     //if ( isMousePressed )
      
      background(0,1);
      translate( stage_width/2 , stage_height / 2 );
      
      beginShape();
      
      var radiusSine:Number = Math.sin(t*10)*spreading;
      
      for(var i:int =-1; i < division ; i++){
                
          var radianTop:Number = (360/division)*(i+0.5+t) * Math.PI / 180;
          var radianBottom:Number = (360/division)*(i+1+t) * Math.PI / 180;
                
          var topPoint:Point = new Point(
              Math.cos(radianTop)*(radiusSine + innerRadius),
              Math.sin(radianTop)*(radiusSine + innerRadius)
          );
                
          var bottomPoint:Point = new Point(
              Math.cos(radianBottom)*(-radiusSine + innerRadius),
              Math.sin(radianBottom)*(-radiusSine + innerRadius)
          );
                
          curveVertex( topPoint.x, topPoint.y );
          curveVertex( bottomPoint.x, bottomPoint.y );
      }

      curveVertex( 
          Math.cos((360/division)*(.5+t) * Math.PI / 180)*(radiusSine + innerRadius),
          Math.sin((360/division)*(.5+t) * Math.PI / 180)*(radiusSine + innerRadius)
      );

      endShape();
      t += 0.01;
      
      if(division > 1000){
          //division = 1;
      } else {
          //division ++;
      }
     }
  }
}