flash on 2010-1-25

by nausicaa
♥0 | Line 30 | Modified 2010-01-25 14:57:50 | MIT License
play

ActionScript3 source code

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

package {
	import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.Bitmap;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import frocessing.core.F5BitmapData2D;
    
    [SWF(width=465, height=465, backgroundColor=0, frameRate=60)]
    public class FlashTest extends Sprite {
    		
    		private var fb:F5BitmapData2D;
    	
        public function FlashTest() {
           	fb = new F5BitmapData2D(465, 465, false, 0);
           	fb.noStroke();
           	fb.colorMode("hsv",1.0); //colorMode("rgb-hsv", range)
           	fb.blendMode = "hardlight";
           	addChild(new Bitmap(fb.bitmapData));
           	
            stage.addEventListener(Event.ENTER_FRAME, enterframe);
            stage.addEventListener(MouseEvent.MOUSE_DOWN, mousedown);
        }
        
        private function enterframe(e:Event):void{
        		fb.beginDraw(); //描画開始
        		fb.fill(Math.random()*0.1, Math.random(), Math.random(), 0.5); //色の塗り fill( hue, saturation, brightness, alpha )
        		fb.circle(mouseX, mouseY, Math.random()*30);
        		fb.endDraw();  //描画終了
        }
        private function mousedown(e:MouseEvent):void{
        		fb.bitmapData.fillRect(fb.bitmapData.rect, 0);
        }
    }
}