Explorer for BitmapData.perlinNoise and BitmapData.noise
If you need to add some random noise to your BitmapData then you have two options:
- myBitmapData.perlinNoise which is sort of smooth gradiations of patterns. Sort of looks like a nebula to me, or
- myBitmapData.noise which is much like static, just a bunch of randomly colored dots
It is very easy to use each method but how changes in the parameters can change the output isn’t very obvious. So I created this Explorer because that’s what I do. I’m an Explorer of Actionscript. :)
| view source |
And now…
Now you can go out and make some noise of your own. Maybe something a little more creative than this. Be sure to drop a comment below if you have anything you would like to share.
Notes
The last parameter passed in the perlinNoise method is for an array of offsets. There’s no easy way to add user controls for editing that many possible arrays – one for each octave. Therefor I just left it out since the default is null. I also did a few experiments with adding an offset array behind the scenes without any user control but the change in visual appearance of the output was so small that I didn’t think it was worth the effort. It’s quite possible I wasn’t doing it right so you should play with it yourself.
Coding conventions
In this Explorer I experimented with changing my coding conventions for giving IDs to components. I usually just give components a descriptive ID and I don’t think about the format that much. This time I placed the type of component at the beginning of the ID string followed by an underscore and then a descriptive name. I often get to a point in an method where I need to access a component and I have to remember the name. The Outline panel is helpful but I don’t use it as much as I should. With this convention all I have to do is type in slid… to get the code hinting for all of the slider components and then just pick it out of the lineup.
What do you think of this convention?
If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.






