flash on 2014-6-23

by tepe
ノイズのテスト
♥0 | Line 26 | Modified 2014-06-23 21:31:55 | MIT License
play

ActionScript3 source code

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

package {
    //ノイズのテスト
    import flash.display.*;
    import flash.utils.*;
    import flash.events.*;
    import flash.geom.*;
    
    
    public class FlashTest extends Sprite {
        private var noise:BitmapData = new BitmapData(sx,sy,false,0xff0000);
        private var sx:int = 128+3;
        private var sy:int = 128;
        private var bmp:Bitmap;
        public function FlashTest() {
            // write as3 code here..
            bmp = new Bitmap(noise);
            //bmp.bitmapData = noise;
            addChild(bmp);
            //addEventListener(MouseEvent.CLICK,func);
            addEventListener(Event.ENTER_FRAME,onFrame);
        }
        private function onFrame(e:Event):void{
            func();
        }

        private function func():void{
            var seed:int = Math.random() * 0xFFFFFF;
            var p1: Point = new Point(), p2: Point = new Point();
            var offset: Array = [p1, p2];
            noise.perlinNoise(sx/2, sy/2, 2, seed, false, true, 7, true, offset);//ノイズ生成
            //noise.perlinNoise(sx/2, sy/2,2,seed,false,true);
        }

        
    }
}