perlin noise scroll test
I don't know about perlin noise's math well. maybe both sides of perlin noise are connected without any gap?
-------------------------
sides are smoothly connected when perlinNoise()'s fifth parameter 'stitch' is true.
/**
* Copyright codeonwort ( http://wonderfl.net/user/codeonwort )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/cGNi
*/
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
}
}
}
}
}