我有一个带有 250x130 位图的介绍屏幕,我想淡入淡出。 我正在使用 tweenlite,它在 Pc 上看起来很棒,但在 iphone 上,它看起来 像 1 或 2 fps,真的很慢。 只有 2 个文本字段和这个动画位图。影片设定为 默认 24fps。代码是
包{
import flash.display.MovieClip;
import com.greensock.TweenLite;
import com.greensock.easing.*;
public class intro extends MovieClip {
public function intro() {
fadesIn();
}
function fadesOut():void{ if (this.visible) TweenLite.to(mc, 4, {delay:1,ease:Cubic.easeInOut, alpha:0,onComplete:fadesIn});}
function fadesIn():void{ if (this.visible) TweenLite.to(mc, 4, {delay:1,ease:Cubic.easeInOut, alpha:1,onComplete:fadesOut});}
}
iphone 渲染是 GPU。我有 stage.quality = StageQuality.LOW;在第一帧。
谢谢
最佳答案
使用 Starling ( http://gamua.com/starling/) 有时是在移动设备上获得良好性能的唯一方法,因为它充分利用了设备上的 GPU。
来自 Adobe 网站 (http://help.adobe.com/en_US/as3/mobile/WS901d38e593cd1bac-3d719af412b2b394529-8000.html):
Enable hardware graphics acceleration in an AIR application by including gpu in the application descriptor (or use direct to leverage Stage3D). You cannot change render modes at runtime. On desktop computers, using gpu will fallback to direct.
Note: In order to leverage GPU acceleration of Flash content with AIR for mobile platforms, Adobe recommends that you use renderMode="direct" (that is, Stage3D) rather than renderMode="gpu". Adobe officially supports and recommends the following Stage3D based frameworks: Starling (2D) and Away3D (3D). For more details on Stage3D and Starling/Away3D, see http://gaming.adobe.com/getstarted/.
还值得注意的是,如果对象正在进行 alpha 处理,cacheAsBitmap 将不起作用。
http://www.republicofcode.com/tutorials/flash/as3cacheasbitmap/
You should note that the cacheAsBitmap property is very restricted and will only use the bitmap cached when the object is static, or moved vertically or horizontally across the stage. If you attempt to rotate the object, change its scale, change its alpha property or attempt to do anything else with it other than changing its shape, the player would have to recalculate the shape of the vector and then draw the bitmap version again for each single step in the transformation. If you apply cacheAsBitmap to an object that is continuously rotating or is being animated in anyway other than changes its x or y property, the process would consume more processing power than the original vector graphic because not only the vector would have to be calculated for each step in the animation, but the bitmap would also have to be drawn for every single step in the animation making the system do double the job!
关于iphone - 为 iPhone Flash 应用程序优化 tweenlite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5187865/