Jump to content


Looking for tips on tweening large images

Recommended Posts

I just did a project using TweenMax and some large imported images. The image manipulation was slow -- which is due to the inherent nature of the beast, nothing to to with TweenMax, I know. What are your tips for tweening large images?


• Alpha: if you're fading in and out Stage-sized images, what works best: tweening the alpha of the image, tweening the alpha of a mask, or...?

• Movement: how to move things swiftly? Is it best to work with bitmaps, movieclips, does it make one iota of difference?


I've seen some interesting code (that Jack pointed to in another post) dealing with quick ways to move a large image across screen (using CopyPixels) -- but this seems something different here.


I'd be curious to hear of any creative solutions -- even extending to using Alchemy or whatever :->

Link to comment
Share on other sites

Don't use masks - those can really hurt performance. If you need to crop a rectangular area, either use scrollRect or create a BitmapData that's the size you need to display, and draw() your object onto it. Of course if you can copyPixels() instead of draw(), that's much faster.


Use Bitmaps instead of MovieClips and vectors


Avoid alpha if you possibly can.


Minimize the area of change that the Flash player needs to render. The more pixels that need to update, the more CPU drain.


There are a bunch of speed-related tips at http://www.greensock.com/tweening-tips/#speed

Link to comment
Share on other sites

Thanks. It's probably that I'm fading the images in -- and sometimes moving them -- that's bogging it down.

Link to comment
Share on other sites

Here is a follow-up question.


I have a full screen image gallery using bitmaps and scrollRect. In one example I tween the alpha (fading in on white background) and in another I tween the tint (using #ffffff).


Based on CPU usage it seems like tweening the tint is getting better performance. Can someone verify this to be the case?

Link to comment
Share on other sites

Yep, that'd make sense. Flash should have an easier time rendering a tint change than an alpha change.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.