AnimationSample
see http://gihyo.jp/design/feature/01/frocessing/0003
/**
* Copyright nutsu ( http://wonderfl.net/user/nutsu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/vazs
*/
// forked from nutsu's TransformSample
// see http://gihyo.jp/design/feature/01/frocessing/0003
package {
import frocessing.display.F5MovieClip2D;
[SWF(width=465,height=465,backgroundColor=0x000000)]
public class AnimationSample extends F5MovieClip2D
{
private var n:int;
private var r:Number;
private var a:int;
//描画プログラムの初期化(ADDED_TO_STAGE)
public function setup():void
{
n = 30;
r = 2*Math.PI/n;
a = 0;
colorMode( HSV, n, 1, 1 );
rectMode( CENTER );
noStroke();
}
//一定間隔で描画を実行する(ENTER_FRAME)
public function draw():void
{
//キャンバスをステージの中心へ移動
translate( 465/2, 465/2 );
//キャンバスを角度a*r回転
rotate( r * a );
//描画
for ( var i:int = 0; i < n; i++ ) {
rotate( r );
fill( i, 1, 1 );
rect( 150, 0, 36, 10, 4, 4 );
}
a++;
}
}
}