Effects on the bitmap with perlinNoise ()

The class BitmapData allows you to apply in a simple way effects very useful for various purposes. We saw how to create an effect "fog TV" with a few lines of code ( Flash CS3: create fog effect TV in 1 second ). Now we will deal with another effect "spectacular" which, as we shall see later, allows the creation of interesting visual effects, as shown in the example below: the parameters varied to observe the different effects, clicking with the mouse on the image generated this can be moved.

Flash Player Loading ...

On this occasion I also added a new simple component (Check) in Undolibrary ! Then update your SVN repository. The source is available here: MapEffect.zip

. The effect shown in the video above is made ​​entirely using the method perlinNoise() made ​​available by the object BitmapData . As indicated in the manual:

The Perlin noise generation algorithm interpolates and combines individual random noise functions (called octaves) into a single function that generates more natural-seeming random noise.

And yet:

The Perlin noise functions can be used to simulate natural phenomena and landscapes, such as wood grain, clouds and mountain ranges.

You can use the demo video to see how it changes the image generated according to its main parameters. In the movie I did not allow the change of the parameter randomSeed , a number that is used for pattern generation randomico (in order for a continuous scroll of the image - click and drag with the mouse).

Source

: The document class MapEffect contains all the code of the demonstration, but the heart of the application is contained in the method doPerlinNoise() :

1
2
3
4
5
6
7
/ *
** @ Name: doPerlinNoise ()
* /
doPerlinNoise ( ) : void { protected function doPerlinNoise (): void {
Point = new Point ( __translateX , __translateY ) ; var p: Point = new Point (translateX __, __ translateY);

}

, che viene poi visualizzato tramite l'oggetto “grafico” Bitmap ( __bmp ). __bmpd is a pointer to an object BitmapData , which is then displayed via the object "graph" Bitmap ( __bmp ). (questo può essere un valore a piacere). All parameters of the call to perlinNoise() are parametric, but - as mentioned before - __seed (this can be a value you like).

There are no comments for this post

Leave a comment

TAG XHTML PERMITS: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL 


Stop SOPA