闪存渲染:优化的技巧和窍门闪存、窍门、技巧

2023-09-08 14:07:16 作者:wō沒變、只是學會ㄋ僞裝

我要一个网站推出不久,所以我已经得到了最后的阶段。时间优化的宝贝!该网站执行pretty的良好的整体,具有32fps的帧率平均。但在有些沉重的动画部分就喜欢砸几帧到大约22FPS。这是不是太可怕了。但我调整它尽可能使其保持在尽可能高的速度运行。

I'm about to push out a website soon and so I've gotten in the last stages. Time to optimize the baby! The website performs pretty good overall, with an average framerate of 32fps. But at some heavy animation parts it likes to drop a couple of frames to about 22fps. Which is not that horrible. But I'm tweaking it as much as possible to keep it running at the highest speed possible.

我可能忽略了一些提示和技巧,使这件宝贝运行更顺畅。

I might overlooked some tips and tricks to make this baby run even smoother.

所以,在此我打开这个线程共享任何忍者招数曾经帮助过你的过去。一对夫妇我的,我能想到的现在:

So hereby I open this thread to share whatever ninja tricks ever helped you in the past. A couple of mine which I can think of right now:

测序动画:

让尽可能少的过渡发生在同一时间,尽量使其采取更作为变压器,一件事的时间。下一步要加快速度的动画,你可能最终会获得更多的流量。

Let as less as possible transitions happen at the same time, try to make it act more as a transformer, one thing at a time. Next to gaining speed in animation, you probably end up gaining more flow.

保留动画对象尽可能小:

所以闪光灯来计算更少的像素同时

So flash has to calculate less pixels at the same time.

的cacheAsBitmap =真:

那些大影片剪辑,矢量图形被搬来搬去,很可能更快地移动,当它们被作为位图缓存。可能需要在你的记忆一定的空间,但任何更高的帧率;)

Those big movieclips, vector shapes being moved around, are probably quicker moved when they are cached as a bitmap. Might take up some space in your memory, but anything for higher framerates ;)

摧毁一切你不使用:

设置那些未使用的影片剪辑为空,然后删除它作为一个孩子。所以,你的垃圾收集照顾它。

Set those unused movieclips to null and then remove it as a child. So your garbage collector takes care of it.

推荐答案

另外一个考虑就是吐温引擎,你正在使用。如果您使用的是自带的闪存一个你可能会切换到像TweenLite的获得一些性能提升(有多个其他好的太)。

Another consideration is what tween engine you're using. If you're using the one that comes with Flash you'll probably gain some performance by switching to something like TweenLite (there are multiple other good ones too).

请记住,将cacheAsBitmap是非常危险的。如果你正在缩放,旋转或更新剪辑本身(如修改它里面的东西阿尔法)闪光灯将必须生成新的快照,这会减缓都记录下来。只要你继续前进x和y的剪辑只有它的好,总是有(如果需要进行旋转,将其关闭,然后再当你完成的)。还要注意的是,如果你使用的过滤器将cacheAsBitmap是的总是的自动上 - >可能是缓慢的。

Keep in mind that cacheAsBitmap can be very dangerous. If you're scaling, rotating or updating the clip itself (such as modifying the alpha of something inside it) flash will have to generate a new snapshot, which will slow everything down. As long as you're moving the clips on x and y only it's good to always have on (if you need to rotate, turn it off and then back on when you're done). Note also that if you're using filters cacheAsBitmap is always automatically on -> may be slow.