for(var i = 0; i < 255; i++) {
redArray[i] = 0x00000000;
greenArray[i] = 0x00000000;
}
redArray[0xFF] = 0x0000FF00;
greenArray[0xFF] = 0x00FF0000;
myBitmapData.paletteMap(myBitmapData, new Rectangle(0, 0, 100, 40), new
Point(0, 0), redArray, greenArray, null, null);
}
perlinNoise (BitmapData.perlinNoise method)
public perlinNoise(baseX:Number, baseY:Number, numOctaves:Number,
randomSeed:Number, stitch:Boolean, fractalNoise:Boolean,
[channelOptions:Number], [grayScale:Boolean], [offsets:Object]) : Void
Generates a Perlin noise image.
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. Like musical octaves, each octave function is twice the frequency of the one before it.
Perlin noise has been described as a "fractal sum of noise" because it combines multiple sets of
noise data with different levels of detail.
You can use Perlin noise functions to simulate natural phenomena and landscapes, such as
wood grain, clouds, and mountain ranges. In most cases, the output of a Perlin noise function
is not displayed directly but is used to enhance other images and give them pseudo-random
variations.
Simple digital random noise functions often produce images with harsh, contrasting points.
This kind of harsh contrast is not often found in nature. The Perlin noise algorithm blends
multiple noise functions that operate at different levels of detail. This algorithm results in
smaller variations among neighboring pixel values.
The Perlin noise algorithm is named for Ken Perlin, who developed it after generating
computer graphics for the 1982 film Tron. Perlin received an Academy Award for
Technical Achievement for the Perlin Noise function in 1997.
Availability: ActionScript 1.0; Flash Player 8
Parameters
- Frequency to use in the x direction. For example, to generate a noise that is
baseX:Number
sized for a 64 x 128 image, pass 64 for the
322
ActionScript classes
value.
baseX
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?