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 2015-8-1

Copyright spanvega ( http://wonderfl.net/user/spanvega )
MIT License ( http://www.opensource.org/licenses/mit-license.php )
Downloaded from: http://wonderfl.net/c/xHXa

@author SPANVEGA // CHRISTIAN
Get Adobe Flash player
by insocium 01 Aug 2015
    Embed
/**
 * Copyright insocium ( http://wonderfl.net/user/insocium )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/nngT
 */

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

package
{
    import flash.geom.*;
    import flash.events.*;
    import flash.display.*;
    import flash.filters.*;

    import com.bit101.components.*;

    /**  @author SPANVEGA // CHRISTIAN  **/

    [ SWF (width = '465', height = '465', backgroundColor = '0x000000', frameRate = '50')]

    public class STELLA extends Sprite
    {
        private var tran : ColorTransform = new ColorTransform (1, 1, 1, 0.95);

        private var blur : BlurFilter = new BlurFilter (2.5, 2.5, 1);

        private var seed : int = Math.random () * uint.MAX_VALUE; 

        private var p_vec : Vector.<PARTICLE> = new <PARTICLE>[];
        private var m_vec : Vector.<Matrix> = new <Matrix>[];
        private var blend : Vector.<String> = new <String>[];

        private var o : Array = [new Point (), new Point ()];

        private var size : int = 465, half : int = size >> 1;

        private var rect : Rectangle = new Rectangle (0, 0, size, size);

        private var emission : Boolean = true;
        private var quantity : Number = 75;
        private var velocity : Number = 5;
        private var speed : Number = 1.5;

        private var limit : int = 10000;

        private var image : BitmapData;
        private var pixel : BitmapData;
        private var model : BitmapData;

        

        private var rad : Number;
        private var num : Number;

        private var m : Matrix, s : String;
        private var p : PARTICLE;

        private var r : Number, g : Number;
        private var b : Number, c : uint;

        private var i : int;


        public function STELLA ()
        {
            stage ? init () : addEventListener (Event.ADDED_TO_STAGE, init);
        }

        private function init () : void
        {
            if (hasEventListener (Event.ADDED_TO_STAGE))
            {removeEventListener (Event.ADDED_TO_STAGE, init);}

            stage.scaleMode = 'noScale';

            m_vec.push
            (
                new Matrix ( 1, 1,-1, 1, half,-half),
                new Matrix (-1,-1,-1, 1, half * 3, half),
                new Matrix (-1,-1, 1,-1, half, half * 3),
                new Matrix ( 1, 1, 1,-1,-half, half)
            );

            blend.push
            (
                BlendMode.INVERT,   BlendMode.HARDLIGHT,
                BlendMode.MULTIPLY, BlendMode.MULTIPLY
            );

            //

            model = new BitmapData (half, half, false, 0);

            image = new BitmapData (size, size, true, 0);

            pixel = image.clone ();

            //

            addChild (new Bitmap (image));

            addChild (new Bitmap (pixel));

            gui ();

            //

            frame (); stage.addEventListener (Event.ENTER_FRAME, frame);
        }

        private function frame (e : Event = null) : void
        {
            o[1].x =- (o[0].x += speed);
            o[1].y =- (o[0].y -= speed);

            // --o CANVAS

            model.perlinNoise (233, 233, 2, seed, true, false, 7, false, o);

            for each (s in blend) model.draw (model, null, null, s);

            for each (m in m_vec) image.draw (model, m);

            // --o PIXELS

            pixel.lock ();

            pixel.colorTransform (rect, tran);
            pixel.applyFilter (pixel, rect, rect.topLeft, blur);

            for each (p in p_vec)
            {
                c = image.getPixel (p.x, p.y);

                r = (c <<  8 >>> 24) / 0x80;
                g = (c << 16 >>> 24) / 0x80;
                b = (c << 24 >>> 24) / 0x40;

                p.x += p.vx * (r - b);
                p.y += p.vy * (g - b);

                pixel.setPixel32 (p.x, p.y, p.c);

                if (p.y < 0 || p.y > size || p.x < 0 || p.x > size)
                {
                    p_vec.splice (p_vec.indexOf (p), 1); p = null;
                }
            }

            //

            

            for (i = 0; i < num; i++)
            {
                p = new PARTICLE ();

                p.c  = 0xFFFFFFFF;
                p.x  = half;
                p.y  = half;

                rad = (Math.random () * 360) * (3.1415926535 / 180);

                p.vx = Math.cos (rad) * velocity;
                p.vy = Math.sin (rad) * velocity;

                p_vec.push (p);
            }

            pixel.unlock ();

            
        }

        private function gui () : void
        {
            with (Style) { BACKGROUND = LABEL_TEXT = DROPSHADOW = 0xFFFFFF; BUTTON_FACE = PROGRESS_BAR = 0x000000; }

         
            

            
        }
    }
}

//

internal class PARTICLE
{
    public var c : uint;
    public var x : Number, vx : Number;
    public var y : Number, vy : Number;
}