f5 spline test 0
// write as3 code here..
package{
import flash.display.*;
import flash.events.Event;
import frocessing.core.F5Graphics2D;
import net.hires.debug.Stats;
[SWF(frameRate="60", backgroundColor="#000000")]
public class CurveTest0 extends Sprite
{
private var fg:F5Graphics2D;
private var w:Number = 465;
private var n:int = 8;
public function CurveTest0()
{
var d:Shape = addChild( new Shape() ) as Shape;
fg = new F5Graphics2D( d.graphics );
fg.noStroke();
fg.curveDetail(30);
addEventListener( Event.ENTER_FRAME, draw );
//
addChild(new Stats());
}
private var a:Number=0;
private function draw( e:Event ):void
{
fg.beginDraw();
fg.translate(w>>1,w>>1);
fg.scale( 100*Math.sin(a/3) );
fg.curveTightness( 25*Math.cos(a) );
fg.beginShape();
for( var i:int=0; i<=n+2; i++ )
{
var rad:Number = i*Math.PI*2/n;
fg.curveVertex( Math.sin(rad), Math.cos(rad) );
}
fg.endShape();
fg.endDraw();
a += 0.05;
}
}
}