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

forked from: forked from: PaintSample

see http://gihyo.jp/design/feature/01/frocessing/0003
/**
 * Copyright siso ( http://wonderfl.net/user/siso )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tAdn
 */

// forked from nutsu's forked from: PaintSample
// forked from nutsu's PaintSample
// see http://gihyo.jp/design/feature/01/frocessing/0003
package {
    import frocessing.display.F5MovieClip2DBmp;
    [SWF(width=465,height=465,backgroundColor=0x000000)]
    public class PaintSample2 extends F5MovieClip2DBmp
    {        
        public function setup():void
        {
            //キャンバスのサイズ指定
            size( 465, 465 );
            //背景の描画
            background( 0 );
            //色指定
            stroke( 0, 0.2 );
            //HSV
            colorMode( HSV, 1 );
        }
        
        public function draw():void
        {
            //マウスが押されているときは描画内容をクリア
            if ( isMousePressed )
                background( 0 );
            
            //dist()で2点間の距離を取得
            var d:Number = dist( pmouseX, pmouseY, mouseX, mouseY );
            if ( d < 3 )
                return;
                
            //中点
            var x1:Number = (pmouseX+mouseX)/2;
            var y1:Number = (pmouseY+mouseY)/2;
            
            //中点の周辺にランダムな円を描画
            d /= 2;
            for ( var i:int = 0; i < int(d); i++ ) {
                var xx:Number = x1 + random( -d, d );
                var yy:Number = y1 + random( -d, d );
                fill( random(0.95, 1), random(0.5, 1), random(0.5, 1) );
                circle( xx, yy, random(1, d/3) );
            }
            
            var r:int = 2*Math.PI/n;
            var n:int =30;
            for ( var j:int = 0; j < n; j++ ) {
        			rotate( r );
        //fill();
        
        	fill( j, 1, 2 );
       	 rect( 150, 0, 36, 10, 4, 4 );
      	}
        }
    }
}