Jump to content
Search Community

Zero length tweens in timelinemax

pmdpmd test
Moderator Tag

Recommended Posts

Hi,

 

Thank you for a great library.

 

If I run the following code:

 

var timeline:TimelineMax = new TimelineMax();

timeline.append(TweenMax.to(pokerPage.dealerButtonObject, 2.0, { x:0 } ));

timeline.append(TweenMax.to(pokerPage.dealerButtonObject, 0.1, { scaleX:5.0, scaleY:5.0 } ));

 

It behaves as expected - moving the image to the left, then blowing it up to 5 times size.

 

However, if I change the duration of the second tween to zero:

 

var timeline:TimelineMax = new TimelineMax();

timeline.append(TweenMax.to(pokerPage.dealerButtonObject, 2.0, { x:0 } ));

timeline.append(TweenMax.to(pokerPage.dealerButtonObject, 0.0, { scaleX:5.0, scaleY:5.0 } ));

 

The image immediately blows up *prior* to the image tweening to the left - i.e. the second tween is no longer occurring in order.

 

Apologies if this is a known issue, I did have a search around to no avail.

 

I appreciate that I can get round this issue using e.g. onComplete, its just for neatness, I would prefer to do it as above.

 

Many thanks,

Paul

Link to comment
Share on other sites

yup this is one of those things you really don't need to know about until you realize you need to know about it;)

 

What you need to do is set the special property immediateRender:false

 

http://www.greensock.com/as/docs/tween/ ... nLite.html

immediateRender : Boolean Normally when you create a tween, it begins rendering on the very next frame (when the Flash Player dispatches an ENTER_FRAME event) unless you specify a delay. This allows you to insert tweens into timelines and perform other actions that may affect its timing. However, if you prefer to force the tween to render immediately when it is created, set immediateRender to true. Or to prevent a tween with a duration of zero from rendering immediately, set immediateRender to false.

 

alter your second tween as follows

var timeline:TimelineMax = new TimelineMax();
timeline.append(TweenMax.to(pokerPage.dealerButtonObject, 2.0, { x:0 } ));
timeline.append(TweenMax.to(pokerPage.dealerButtonObject, 0.0, { scaleX:5.0, scaleY:5.0, immediateRender:false } ));

 

you should be good to go!

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...