Jump to content
Search Community

Tweening two objects at difference rates [SOLVED]

barryg test
Moderator Tag

Recommended Posts

I have multiple images stack on top of each other in a display list. The alpha is set to zero on all but the top. I'm moving the newly selected child to the top of the display list (loaderMain_Curr) and tweening the alpha to "1.0" and the previous child (loaderMain_Prev) alpha to "0.0". I would like to use a difference time on each one and or ease:"types" to get the effect that I'm looking for, but it appears that their both using the same time and "types". This code is being called on a mousEvent:Click and is being executed within the handler.

 

Is there another method on either Lite or Max where I can accomplish this.

 

TweenLite.to(loaderMain_Prev, 0.7, {alpha:0.0, ease:Circ.easeOut});
TweenLite.to(loaderMain_Curr, 1.0, {alpha:1.0, ease:Circ.easeOut});

Link to comment
Share on other sites

Why do you think they're both using the same duration? It looks like your code uses 0.7 seconds for 1 and 1 second for the other.

 

Also, for the record, I'd recommend using the autoAlpha plugin for this stuff because it will automatically toggle the visible property once alpha hits zero which could significantly improve performance in Flash's rendering of the graphics. Keep in mind that even if the alpha is zero, Flash must still render it, but if visible is false, the rendering engine can ignore it. This has nothing to do with the tweening engine, but I mention it because you'll probably see a big performance boost especially if you've got a lot of images on top of each other.

Link to comment
Share on other sites

Each one is difference on its rate. I changed the ease type to Quint.easeOut and set the time 4 seconds on alpha:1 and 2 seconds on alpha:0 to test.

 

I also tried using autoAlpha and I'm getting the following Errors.

The images that I'm applying alpha to are of type Bitmaps that are children of a sprite container.

 

TweenLite.to(bitmapObj, 0.5, {autoAlpha:0, ease:Quint.easeOut})

Errors Generated.  Repeated many times

ReferenceError: Error #1069: Property autoAlpha not found on flash.display.Bitmap and there is no default value.
at com.greensock::TweenLite/init()
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()

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.
×
×
  • Create New...