Drawing Flower with Frocessing

by utabi
♥0 | Line 50 | Modified 2009-08-20 16:14:19 | MIT License
play

ActionScript3 source code

/**
 * Copyright utabi ( http://wonderfl.net/user/utabi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/m8QN
 */

package {
  import flash.geom.Point;
  import frocessing.display.*;
  
  [SWF(width="465", height="465", frameRate="60")]
  
  public class Flower extends F5MovieClip2DBmp{
    
    private var stage_width:Number  = 465;
    private var stage_height:Number = 465;
    private var t:Number = 55;
    private var division:int = 10;
    private var innerRadius:int = 40;
    private var outerRadius:int = 185;
    
    public function Flower() {
      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();
      
      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)*outerRadius,
              Math.sin(radianTop)*outerRadius
          );
                
          var bottomPoint:Point = new Point(
              Math.cos(radianBottom)*innerRadius,
              Math.sin(radianBottom)*innerRadius
          );
                
          curveVertex( topPoint.x, topPoint.y );
          curveVertex( bottomPoint.x, bottomPoint.y );
      }

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

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

Forked