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: 使徒襲来

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

// forked from watanabe's 使徒襲来
// forked from hacker_n96o8lrr's forked from: BitmapDataSample9
// forked from nutsu's BitmapDataSample9
package {
    
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.display.BitmapDataChannel;
    import flash.geom.Point;
    import flash.events.Event;
    
    [SWF(width=465,height=465,backgroundColor=0)]
    public class BitmapDataSample9 extends Sprite {
        
        private var bmpdata:BitmapData;
        private var out:BitmapData        
        
        private var mapR:Array=[]
        private var mapG:Array=[]
        private var mapB:Array=[]

        
        public function BitmapDataSample9() {
            //BitmapDataを作成して表示リストに追加
            bmpdata = new BitmapData( 465, 465, false, 0 );
            out = bmpdata.clone();
            stage.quality="low";
            for(var i:int = 0; i < 0x100; i++) {
               
                mapB[i] = (i%3==0) ? 255:0
                mapG[i] = (i%3==1) ? 255 << 8 : 0;
                mapR[i] = (i%3==2) ? 255 << 16 : 0;
               
            }           
                        
            var bmp:Bitmap = new Bitmap(out);
            
            addChild( bmp );
            //イベント
            addEventListener( Event.ENTER_FRAME, enterframe );
        }
        
        private var baseX:Number         = 60;
        private var baseY:Number         = 60;
        private var octaves:uint         = 2;
        private var randomSeed:int       = Math.random()*0xffffffff;
        private var stitch:Boolean       = false;
        private var fractalNoise:Boolean = true;
        private var channelOptions:int   = BitmapDataChannel.RED|BitmapDataChannel.BLUE;
        private var grayScale:Boolean    = true;
        private var offset:Array         = [new Point(),new Point(),new Point()];
        
        private function enterframe(e:Event):void {
            //PerlinNoise
            bmpdata.perlinNoise( baseX, baseY, octaves, randomSeed, 
                                 stitch, fractalNoise, channelOptions, grayScale, offset );
            offset[0].y += 1;
            //offset[1].y += 1;
           // offset[2].y += 0.5;
            
            out.paletteMap(bmpdata,bmpdata.rect,new Point(),mapR,mapG,mapB);
        }
    }
}