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

flash on 2011-6-22

Get Adobe Flash player
by yama3 22 Jun 2011
    Embed
/**
 * Copyright yama3 ( http://wonderfl.net/user/yama3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/x9z2
 */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.filters.BlurFilter;
    import flash.geom.ColorTransform;
    import flash.geom.Point;
    import idv.cjcat.stardust.common.actions.Age;
    import idv.cjcat.stardust.common.actions.AlphaCurve;
    import idv.cjcat.stardust.common.actions.DeathLife;
    import idv.cjcat.stardust.common.actions.ScaleCurve;
    import idv.cjcat.stardust.common.clocks.SteadyClock;
    import idv.cjcat.stardust.common.initializers.Life;
    import idv.cjcat.stardust.common.initializers.Scale;
    import idv.cjcat.stardust.common.math.UniformRandom;
    import idv.cjcat.stardust.twoD.actions.Accelerate;
    import idv.cjcat.stardust.twoD.actions.DeathZone;
    import idv.cjcat.stardust.twoD.actions.Move;
    import idv.cjcat.stardust.twoD.emitters.Emitter2D;
    import idv.cjcat.stardust.twoD.handlers.DisplayObjectHandler;
    import idv.cjcat.stardust.twoD.initializers.DisplayObjectClass;
    import idv.cjcat.stardust.twoD.initializers.Position;
    import idv.cjcat.stardust.twoD.initializers.Velocity;
    import idv.cjcat.stardust.twoD.zones.LazySectorZone;
    import idv.cjcat.stardust.twoD.zones.SinglePoint;
    
    [SWF(backgroundColor=0x000000)]
    
    public class FlashTest extends Sprite {
        private var emitter:Emitter2D;
        private var point:SinglePoint;
        private var blur:BlurFilter = new BlurFilter(3, 3, 3);
        private var canvas:Bitmap;
        private var sp:Sprite = new Sprite();        
        
        public function FlashTest() {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            canvas = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, true, 0xffffff));
            
            addChild(sp);
            addChild(canvas);
            
            var clock:SteadyClock = new SteadyClock(1);
            emitter = new Emitter2D(clock);
            
            point = new SinglePoint();
            emitter.addInitializer(new DisplayObjectClass(Circle));
            emitter.addInitializer(new Velocity(new LazySectorZone(4, 0.5)));
            emitter.addInitializer(new Life(new UniformRandom(30, 0)));
            emitter.addInitializer(new Scale(new UniformRandom(1, 0.5)));
            emitter.addInitializer(new Position(point));
            
            emitter.addAction(new Age());
            emitter.addAction(new DeathLife());
            
            var alph:AlphaCurve = new AlphaCurve(0, 30);
            alph.inAlpha = 1;
            alph.outAlpha = 0;
            emitter.addAction(alph);
            
            emitter.addAction(new Move());
            emitter.particleHandler = new DisplayObjectHandler(sp);
            
            addEventListener(Event.ENTER_FRAME, loop);           
        }
        
        private function loop(e:Event):void
        {
            canvas.bitmapData.lock();
            
            point.x = mouseX;
            point.y = mouseY;
            emitter.step();
            
            canvas.bitmapData.applyFilter(canvas.bitmapData, canvas.bitmapData.rect, new Point(), blur);
            canvas.bitmapData.colorTransform(canvas.bitmapData.rect, new ColorTransform(1, 1, 1, 1, 0, 0, 0, -.99));
            canvas.bitmapData.draw(sp, null, null);
            canvas.bitmapData.unlock();
        }
    }
}

import flash.display.Sprite;
import frocessing.color.ColorHSV;

class Circle extends Sprite {
    static private var col:int = 360;
    public function Circle() {
        var color:ColorHSV = new ColorHSV(col += 4, 4);
        graphics.beginFill(color.value, 0.2);
        graphics.drawCircle(0, 0, 10);
        this.blendMode = "add";
        graphics.endFill();
    }

}