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

forked from: code on 2009-1-13

Get Adobe Flash player
by mr_mg 05 Nov 2011
// forked from mtok's code on 2009-1-13
package  
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.MovieClip;
    import flash.display.BlendMode;
    import flash.filters.BlurFilter;
    
    import flash.events.Event;
    import flash.geom.Matrix;
    import flash.geom.Rectangle;
    [SWF(width=465, height=465, backgroundColor=0x404080, frameRate=30)]    

    public class Spiral extends MovieClip
    {
        private var bmp:Bitmap;
        private var i:int;
        private var trans:Matrix;
        public function Spiral() 
        {
            var c:Number = Math.cos( Math.PI / 35);
            var s:Number = Math.cos( Math.PI / 35);
            
            //trans = new Matrix(c, s, -s, c, 0, 0 );
            trans = new Matrix(
            0.9751040819724653, 0.0978367483138916,
            -0.0978367483138916, 0.9751040819724653,
            12.27326663414263, -7.294083028635697);
            addEventListener(Event.ADDED_TO_STAGE, addedToStage);
        }
        
        private function addedToStage(e:Event):void 
        {
            removeEventListener(e.type, arguments.callee);
            
            bmp = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, false, 0));
            addChild(bmp);
            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }
        
        private function enterFrameHandler(e:Event):void 
        {
            bmp.bitmapData.fillRect(
                new Rectangle(
                    220 * Math.sin(i / 70) + 220,
                    220 * Math.cos(i / 50) + 220,
                    5, 5),
                  (int(Math.sin(i / 87)                    * 64) << 16)
                + (int(Math.sin(i / 100 + Math.PI * 2 / 3) * 128) << 8)
                + (int(Math.sin(i / 130 + Math.PI * 4 / 3) * 128)) + 0xffffff);
            bmp.bitmapData.draw(bmp.bitmapData, 
            trans, null, BlendMode.LIGHTEN, null, true);
            bmp.bitmapData.applyFilter(bmp.bitmapData, bmp.bitmapData.rect, bmp.bitmapData.rect.topLeft, new BlurFilter(0,0));
            i++;
        }
        
    }
    
}