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:
Sequencing the animation:
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.
Keep the animating objects as small as possible:
So flash has to calculate less pixels at the same time.
cacheAsBitmap = true:
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 ;)
Destroy everything you do not use:
Set those unused movieclips to null and then remove it as a child. So your garbage collector takes care of it.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With