ActionScript - 屏幕淡入淡出性能优化?
我正在构建一个在启动时淡入的 AIR 应用程序。通常,启动时窗口的边界非常大或全屏。
淡入淡出的过程非常不稳定,但我在补间 alpha 属性之前已将矢量形状转换为位图。
我如何进一步优化以实现平滑淡入?
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});
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});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
位图位看起来很简单,但您可以尝试使用不同的补间库,例如 TweenLite< /a>,有时会有巨大的性能差异。
如果这没有帮助,则可能是 AIR 窗口透明度性能存在问题,在这种情况下,您可以通过尝试拍摄窗口后面内容的位图快照并在内部将其交叉淡入淡出作为另一个位图来捏造它。
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.