draw flame(s0
Updates the flame bitmap data each frame, creating the animation.
private function drawFlame():void {
// move the flame image up slightly, creating upward movement of flames
_flame.scroll(0, -3);
// draw the current filtered image into flame at a reduced alpha
_flame.draw(
_filteredScreen,
null,
new ColorTransform(1, 1, 1, .1)
);
// 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,
2,
8,
DisplacementMapFilterMode.CLAMP
)
);
}
}
}