draw flame(s)
Updates the flame bitmap data each frame, creating the animation.
private function drawFlame():void {
// draw the current stage image into flame at a reduced brightness and alpha
_flame.draw(
stage,
null,
new ColorTransform(.9, .9, .9, .7)
);
// blur drawn image slightly, more on y axis
ImageUtil.applyFilter(
_flame,
new BlurFilter(3, 5)
);
// move the flame image up slightly, creating upward movement of flames
_flame.scroll(0, -4);
// apply new Perlin noise with altered offset
applyNoise();
// displacement flame image with updates Perlin noise
ImageUtil.applyFilter(
_flame,
new DisplacementMapFilter(
_perlinNoise,
new Point(),
BitmapDataChannel.RED,
BitmapDataChannel.RED,
1,
10,
DisplacementMapFilterMode.CLAMP
)
);
}