forked from: perlin noise scroll test

by yangliu9812 forked from perlin noise scroll test (diff: 1)
♥0 | Line 24 | Modified 2016-01-22 14:51:53 | MIT License
play

ActionScript3 source code

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

// forked from codeonwort's perlin noise scroll test
package {
    
    import flash.events.Event
    import flash.display.Sprite
    import flash.display.Bitmap
    import flash.display.BitmapData
    
    public class FlashTest extends Sprite {
       
        public function FlashTest() {
            // write as3 code here..
            var bd:BitmapData = new BitmapData(465, 465, false, 0x0)
            bd.perlinNoise(465, 465, 8, 15, true, false)
            
            var bmp1:Bitmap = addChild(new Bitmap(bd)) as Bitmap
            var bmp2:Bitmap = addChild(new Bitmap(bd)) as Bitmap
            bmp2.x = bmp1.width
            
            addEventListener("enterFrame", loop)
            function loop(e:Event):void {
                bmp1.x -= 5
                bmp2.x -= 5
                if(bmp1.x <= -bmp1.width){
                    bmp1.x = 0
                    bmp2.x = bmp1.width
                }

            }

        }
        
    }
    
}