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

Stardust 触ってみたよ。

Get Adobe Flash player
by soundkitchen 12 Oct 2010
/**
 * Copyright soundkitchen ( http://wonderfl.net/user/soundkitchen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dS8q
 */

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BlendMode;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    import flash.geom.Matrix;
    import flash.geom.Point;

    import idv.cjcat.stardust.common.actions.*;
    import idv.cjcat.stardust.common.clocks.*;
    import idv.cjcat.stardust.common.initializers.*;
    import idv.cjcat.stardust.common.math.*;
    import idv.cjcat.stardust.twoD.actions.*;
    import idv.cjcat.stardust.twoD.emitters.Emitter2D;
    import idv.cjcat.stardust.twoD.initializers.*;
    import idv.cjcat.stardust.twoD.renderers.*;
    import idv.cjcat.stardust.twoD.zones.*;

    import net.hires.debug.Stats;

    [SWF(width=800, height=600, frameRate=48, backgroundColor=0x00)]
    public class Main extends Sprite
    {
        private var film:BitmapData;
        private var bitmap:Bitmap;
        private var container:Sprite;
        private var emitter:Emitter2D;
        private var renderer:DisplayObjectRenderer;

        private var mouse:SinglePoint;

        public function Main()
        {
            addEventListener(Event.ADDED_TO_STAGE, _onAdded);
        }

        private function _onAdded(evt:Event):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, _onAdded);

            var W:int, H:int;

            W = stage.stageWidth >> 0 || 800;
            H = stage.stageHeight >> 0 || 600;

            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            container = new Sprite();
            addChild(container);

            film = new BitmapData(W>>2, H>>2, true, 0);
            bitmap = new Bitmap(film);
            bitmap.blendMode = BlendMode.ADD;
            bitmap.smoothing = true;
            bitmap.transform.matrix = new Matrix(4, 0, 0, 4);
            addChild(bitmap);

            emitter = new Emitter2D(new SteadyClock(3));
            // initializers.
            emitter.addInitializer(new DisplayObjectClass(Firefly));
            emitter.addInitializer(new Life(new UniformRandom(150, 30)));
            emitter.addInitializer(new Color(0xFFFFFF));
            mouse = new SinglePoint(mouseX, mouseY);
            emitter.addInitializer(new Position(mouse));
            emitter.addInitializer(new Velocity(new LazySectorZone(1.5, .6)));
            emitter.addInitializer(new Scale(new UniformRandom(1, .3)));
            // actions.
            emitter.addAction(new Age());
            emitter.addAction(new DeathLife());
            emitter.addAction(new Move());
            emitter.addAction(new AlphaCurve(40, 40));
            emitter.addAction(new RandomDrift(.25, .25));
            emitter.addAction(new SpeedLimit(2.2));
            emitter.addAction(new DeathZone(new RectZone(-60, -60, W + 120, H + 120), true));

            renderer = new DisplayObjectRenderer(container);
            renderer.addEmitter(emitter);

            addChild(new Stats());

            addEventListener(Event.ENTER_FRAME, _onEnterFrame);
        }

        private function _onEnterFrame(evt:Event):void
        {
            mouse.x = mouseX;
            mouse.y = mouseY;

            emitter.step();

            film.lock();
            film.colorTransform(film.rect, new ColorTransform(1, 1, 1, .45));
            film.draw(container, new Matrix(1/4, 0, 0, 1/4));
            film.unlock();
        }
    }
}

import flash.display.Shape;

class Firefly extends Shape
{
    public function Firefly()
    {
        graphics.beginFill(0xFFFFFF);
        graphics.drawCircle(0, 0, 3);
        graphics.endFill();
    }
}