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

風車2(マウスで色付け)

see http://gihyo.jp/design/feature/01/frocessing/0002
マウスでドラッグしながらぐりぐりすると模様が加わる〜♪♪
/**
 * Copyright teageek ( http://wonderfl.net/user/teageek )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/sixq
 */

// forked from teageek's 風車みたいな(マウスで色付け)
// see http://gihyo.jp/design/feature/01/frocessing/0002
//マウスでドラッグしながらぐりぐりすると模様が加わる〜♪♪
package  
{
    import frocessing.display.F5MovieClip2D;
    import flash.filters.*;
    import flash.utils.*;
    import flash.ui.*;
    
    [SWF(width=465,height=465,backgroundColor = 0x0)]
    public class ColorModeSample extends F5MovieClip2D
    {
        private var xs:Array;
        private var ys:Array;  
        private var n:int;
        private var r:Number;
        private var a:int;
        public function setup():void 
        {
            //this.filters = [new BlurFilter (4, 4, 2)]; 
             n = 30;
             r = 2*Math.PI/n;
             a = 0;
             colorMode( HSV, n, 1, 1 );
            // stroke( 255 );
            stroke(n,1,1)
            noFill(); 
            
           // noFill();
            xs = [];
            ys = [];
        }
        public function mousePressed():void
        {
            xs = [];
            ys = [];
        }
        public function draw():void{
            
            if( isMousePressed ){
                xs.push( mouseX -465/2);
                ys.push( mouseY -465/2);
            }
            
             //キャンバスをステージの中心へ移動
          translate( 465/2, 465/2 );
            
          //キャンバスを角度a*r回転
          rotate( -r * a );                  
          //描画
          for ( var i:int=0; i < n; i++ ) {
            for ( var j:int = 0; j <= n; j++ ) {
 
                rotate(r*2);
                stroke(i,1,n-j)
                //円の描画
                var cx:Number = 10 * i;
                var cy:Number = 10 * j;
                //circle( cx, cy, 2);
                circle( xs[i], ys[i], 5);
                line( xs[i], ys[i], mouseX-465/2, mouseY-465/2 );
              }
          }
                     
              a++;
        }
    }
}