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-4-1

mix of previous shenanigans:
http://wonderfl.net/c/w6IV
http://wonderfl.net/c/yP7k
Get Adobe Flash player
by mutantleg 01 Apr 2015
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/iFBj
 */

package {
    import flash.geom.Point;
    import flash.filters.BlurFilter;
    import flash.geom.Matrix;
    import flash.geom.ColorTransform;
    import flash.geom.Rectangle;
    import flash.display.StageQuality;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            
            stage.quality = StageQuality.LOW;
            
            var num:int;            var i:int;
            var k:int;            var yt:int;
            var w:int;
                        
            mw = 16;            mh = 16;
           // mw=9;mh=9;
            
            num = mw*mh;
            vecFace = new Vector.<int>(num,false);
            
           w = 0;
           for (i = 0; i < mh; i++)
           {
                yt = i*(mw+1);            
            for (k = 0; k < mw; k++)
            {
                  vecFace[w] = 0 + k + yt; //0
                  vecFace[w+1] = 0 + k + (mw+1) + yt; //1
                  vecFace[w+2] = 1 + k + yt; //2
                                    
                  vecFace[w+3] = 1 + k + yt; //2
                  vecFace[w+4] = 0 + k + (mw+1) + yt; //1
                  vecFace[w+5] = 1 + k + (mw+1) + yt; //3

                  w+=6;      
                }//nextk
            }//nexti
            
            //bWire = true;

            num = (mw+1)*(mh+1);
            vecVert2 = new Vector.<Number>(num*2,false);
            vecUv = new Vector.<Number>(num*2,false);
            
           var temp:BitmapData;
           temp = new BitmapData(256,256,true,0);
           temp.perlinNoise(16,7,22,44,true,true,7,true);
           img = temp;
           var ct:ColorTransform;
           var r:Rectangle;
           /*
           ct = new ColorTransform(0.8,0.7,0.8);
           r = new Rectangle(0,0,32,32);
            w=0;
           for (i=0;i<256;i+=32)
           {w =1-w;
           for (k=0;k<256;k+=64)
           {
             r.x = k + (w*32); 
             r.y = i;  
             img.colorTransform(r, ct);
           }}
           */
           ct = new ColorTransform(0.1,0.1,2.0, 0.25);
           img.colorTransform(img.rect,ct);

           canvas = new BitmapData(temp.width,temp.height,false,0);

          skin = new BitmapData(128,128,false,0);       
            updatePlasm(skin, 99);

          stage.addEventListener(MouseEvent.CLICK, onClick);
          stage.addEventListener(Event.ENTER_FRAME, onEnter);            
        }//ctor
        
        public function onClick(e:MouseEvent):void
        { bWire = !bWire; }
        
        public var bWire:Boolean = false;
        
        public var vecFace:Vector.<int>;
        public var vecVert2:Vector.<Number>;
        public var vecUv:Vector.<Number>;
        public var mw:int =0;
        public var mh:int = 0;
        
        public var gt:int = 0;

        public var skin:BitmapData;        
        public var img:BitmapData;        
        public var canvas:BitmapData;



       public function updatePlasm(to:BitmapData, t:int):void
       {
          var i:int; var k:int;  var d:Number;
          var u:Number;   var v:Number;
          var ux:Number; var uy:Number;
          var w:int; var h:int;
          w = to.width; h=to.height;
          
          u = t * 0.1;
          for (i = 0; i < w; i++)
          {
            u+=Math.sin(i*0.06);
              for (k = 0; k < h; k++)
                {
               
                ux = (u+k) * 0.07;        uy = (u+i) * 0.05;
                v = Math.sin(ux);        v += Math.cos(uy);
                v = Math.sin(v*3.1415*4+u);
                to.setPixel32(k, i, 0xFF000000+ (v+1) * 64 );  
              }
          }

       }//uplasm
            



        public function onEnter(e:Event):void
        {
            
            var num:int;            var i:int;            var k:int;            var yt:int;
            var cw:Number;            var ch:Number;
            var tx:Number;            var ty:Number;
            var u:Number;           var v:Number;
            var w:int;      

            cw =32; ch = 32;
            tx = 32;            ty = 32;            
            u = gt*0.1;            v = gt*0.1+0.043;
            tx =0; ty=0;
            cw = 465/mw;            ch = 465/mh;
            
            
           w = 0;
           for (i = 0; i < (mh+1); i++)
           {
                yt = i*(mw+1);            
            for (k = 0; k < (mw+1); k++)
            {
                vecVert2[w] = k*cw + tx;
                vecVert2[w+1] = i*ch + ty;
                
        
                if (k >0 && k <mw)
                { 
                 vecVert2[w] += Math.sin(u)*17; u+=0.5; //u+=0.9;                 
                }
                
                if (i > 0 && i < mh)
                { 
                    vecVert2[w+1] += Math.cos(v)*19; v+=0.7; 
                    
                }
                
                
                vecUv[w] = k/mw; //+ (Math.sin(gt*0.03)*Math.cos(gt*0.03))*0.07;
                vecUv[w+1] = i/mh;// + (Math.sin(gt*0.03+1.57)*Math.cos(gt*0.03))*0.07;
                
                w+=2;

            }//nextk
           }//nexti

          
           
           
           graphics.clear();
           if (bWire){ graphics.lineStyle(1,0); }


            updatePlasm(skin,gt);

            //mat.a = 2; mat.d=2;
            mat.identity();     
            mat.translate(-64,-64);
            mat.rotate(gt*0.006);
            mat.scale(2.75,2.75);
            mat.translate(128,128);
            canvas.draw(skin, mat);
            canvas.applyFilter(canvas,canvas.rect,dp,filt);
            canvas.draw(img);

/*
                 mat.identity();     
                mat.translate(-64,-64);
                mat.rotate(gt*0.01+0.05);
                mat.scale(3,3);
                mat.translate(128,128);
                canvas.draw(skin, mat, tempCt);
 */          

            canvas.unlock();
            canvas.lock();           
           
           graphics.beginBitmapFill(canvas,null,true,false);
             graphics.drawTriangles(vecVert2, vecFace, vecUv);
           graphics.endFill(); 

            /*
            graphics.beginBitmapFill(skin,null,false,false);
            graphics.drawRect(0,0,skin.width,skin.height);
            graphics.endFill();
            */

            
            gt +=1;
                        
        }//onenter

        public var dp:Point = new Point();
        public var filt:BlurFilter = new BlurFilter();
        public var tempCt:ColorTransform = new ColorTransform(1,1,1,0.5);        
        public var tempRect:Rectangle = new Rectangle();
        public var mat:Matrix = new Matrix();
      
        
    }//classend
}