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

[Flint] Mutual

@author paq89
Get Adobe Flash player
by paq 06 Dec 2010
/**
 * Copyright paq ( http://wonderfl.net/user/paq )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/rYke
 */

package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.BlurFilter;
    import flash.geom.Rectangle;
    import org.flintparticles.twoD.renderers.BitmapRenderer;
    
    /**
     * @author paq89
     */
    [SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="60")]
    public class Main extends Sprite 
    {
        
        public function Main():void 
        {
            WonderflTemplate.Initialize(this, init, 60, 0xCC0000);
        }
        
        private function init(e:Event = null):void 
        {
            var emitter:MyEmitter = new MyEmitter();
            
            var renderer:BitmapRenderer = new BitmapRenderer(new Rectangle(0, 0, WonderflTemplate.WIDTH, WonderflTemplate.HEIGHT));
            renderer.addFilter(new BlurFilter(8, 8, 3));
            renderer.addEmitter(emitter);
            addChild(renderer);
            
            emitter.start( );
        }
        
    }
    
}

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.actions.Fade;
import org.flintparticles.common.counters.Steady;
import org.flintparticles.common.displayObjects.Dot;
import org.flintparticles.common.energyEasing.Quadratic;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.common.initializers.SharedImage;
import org.flintparticles.twoD.actions.DeathZone;
import org.flintparticles.twoD.actions.Move;
import org.flintparticles.twoD.actions.MutualGravity;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.Position;
import org.flintparticles.twoD.initializers.ScaleAllInit;
import org.flintparticles.twoD.zones.RectangleZone;

class MyEmitter extends Emitter2D
{
    public function MyEmitter():void
    {
        counter = new Steady(2);
        
        addInitializer(new SharedImage(new Dot(2)));
        addInitializer(new ScaleAllInit(1, 2));
        addInitializer(new ColorInit(0xFFFFFFFF, 0xFFFFFFFF));
        addInitializer(new Position(new RectangleZone(0, 0, WonderflTemplate.WIDTH, WonderflTemplate.HEIGHT)));
        addInitializer(new Lifetime(10, 10));

        addAction(new MutualGravity(50, 100, 5));
        addAction(new Age(Quadratic.easeOut));
        addAction(new Move());
        addAction(new Fade(0, 1));
    }
}

/**
 * 初期化テンプレート
 * @see http://wonderfl.net/c/isiH
 */
class WonderflTemplate
{
    public static const WIDTH:int = 465;
    public static const HEIGHT:int = 465;
    
    private static var _target:Sprite;
    private static var _handler:Function;
    
    static private var _background:Bitmap;
    static private var _backgroundColor:uint;
    
    public static function Initialize(target:Sprite, handler:Function, fps:Number, bgColor:uint, captureDelay:int = -1, resize:Boolean = false):void
    {
        _target = target;
        _handler = handler;
        _backgroundColor = bgColor;

        target.stage.frameRate = fps;
        if (resize)
        {
            target.stage.scaleMode = StageScaleMode.NO_SCALE;
            target.stage.align = StageAlign.TOP_LEFT;
            target.stage.addEventListener(Event.RESIZE, resizeHandler);
        }
        
        _background = new Bitmap(new BitmapData(WIDTH, HEIGHT, false, _backgroundColor));
        target.addChild(_background);
        
        if (captureDelay > 0) Wonderfl.capture_delay(captureDelay);
        
        target.addEventListener(Event.ADDED_TO_STAGE, addToStageHandler);
    }
    
    private static function addToStageHandler(event:Event):void
    {
        _target.removeEventListener(Event.ADDED_TO_STAGE, addToStageHandler);
        _handler();
    }
    
    private static function resizeHandler(e:Event):void 
    {
        _background.bitmapData.dispose();
        _background.bitmapData = new BitmapData(_target.stage.stageWidth, _target.stage.stageHeight, false, _backgroundColor);
    }
}