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

Ink!!!!!

Get Adobe Flash player
by kjkmr 16 Jan 2009
// forked from kimu's Random BlendMode
// forked from kimu's お試し
package {
    import flash.display.Sprite;
    import flash.display.BlendMode;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.filters.BlurFilter;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Matrix;
    import flash.geom.ColorTransform;
	
    public class GraphicTest extends Sprite {
        
        private var grahpicSprite:Sprite;
        private var blurBitmap:Bitmap;
        private var blurBitmapData:BitmapData;
        private var blendModes:Array;
        private var _play:Boolean = false;
        public var drawX:Number = 0;
        public var drawY:Number = 0;
        private var lastDrawX:Number = 0;
        private var lastDrawY:Number = 0;

        public function GraphicTest() {
            blendModes = [BlendMode.ADD, BlendMode.MULTIPLY,BlendMode.OVERLAY];
            blurBitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0);
            blurBitmap = new Bitmap(blurBitmapData);
            blurBitmap.height += 30;
            blurBitmap.filters = [new BlurFilter(16,16,3)];
            addChild(blurBitmap);
            grahpicSprite = new Sprite();
            addChild(grahpicSprite);
            play = true;
            stage.addEventListener(MouseEvent.CLICK,toggle);
        }
        public function toggle(e:Event):void {
            play = !play;
        }

        public function get play():Boolean { return _play; }
        public function set play(p:Boolean):void {
            _play = p;
            if ( _play ) addEventListener(Event.ENTER_FRAME,paint);
            else removeEventListener(Event.ENTER_FRAME,paint);
        }

        public function paint(e:Event):void {
            grahpicSprite.visible = true;
            var b:String = blendModes[(Math.random()*(blendModes.length-1)) >> 0];
            blurBitmapData.draw(this,null,null,b);
            grahpicSprite.graphics.clear();
            drawX += Math.floor((mouseX - drawX)*0.2);
            drawY += Math.floor((mouseY - drawY)*0.2);
            if ( lastDrawX == drawX && lastDrawY == drawY ) return;
            var c:uint = Math.random()*Math.pow(255,4);
            grahpicSprite.graphics.beginFill(c);
            var r:Number = (Math.abs(drawX-lastDrawX)+Math.abs(drawY-lastDrawY))*4.0;
            grahpicSprite.graphics.drawCircle(drawX,drawY,r );
            grahpicSprite.graphics.endFill();
            grahpicSprite.visible = false;
            lastDrawX = drawX;
            lastDrawY = drawY;
        }
    }
}