I’m building an AIR application that fades in on launch. Often the window’s bounds at launch is very large or in full screen.
The fade is undesirably choppy, but I’ve converted the vector shape into a bitmap prior to tweening the alpha property.
How can I optimize this further to achieve a smooth fade in?
faderFill = new Shape();
faderFill.graphics.beginFill(0x000000, 1.0);
faderFill.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
faderFill.graphics.endFill();
faderBitmapData = new BitmapData(faderFill.width, faderFill.height);
faderBitmapData.draw(faderFill);
faderBitmap = new Bitmap(faderBitmapData, PixelSnapping.NEVER, false);
faderBitmap.width = stage.stageWidth;
faderBitmap.height = stage.stageHeight;
addChild(faderBitmap);
Tweener.addTween(faderBitmap, {time: 1.0, transition: Equations.easeNone, alpha: 0.0});
The bitmap bit looks as simple as it can get to me, but you could try to use a different tween library like TweenLite, sometimes there are huge performance differences.
If that doesn’t help, it might be that the AIR window transparency performance is the problem, in which case you could fudge it by trying to take a bitmap snapshot of what’s behind the window and crossfade with that as another bitmap internally.