Jump to content
Search Community

New Point as DynamicProps in TimelineMax

djkencloud test
Moderator Tag

Recommended Posts

Hello...

 

I have a timeline max instance/sequence.

 

In that instance I have a sprite (_over) that pops on the stage using transformAroundPoint. As per the 2 lines of code below, at first I set its initial values in the first tweenmax inserted, after a 2 second delay I tween 'on' the sprite in the second tweenmax inserted, and pop on it comes. This works fine.

 

_timeline.insert( TweenMax.to(_over, 0, {alpha:0, transformAroundPoint:{point:getNewPoint(), scaleX:0.9, scaleY:0.9, shortRotation:{rotation:20}}}) )

 

_timeline.insert( TweenMax.to(_over, 1, { delay:2, alpha:1, transformAroundPoint: { point:getNewPoint(), scaleX:1, scaleY:1, shortRotation:{rotation:0}}, ease:Elastic.easeOut } ) );

 

My problem is that when the stage resizes, the point gets changed, and when you navigate back to that page and the timeline max sequence goes through its motions, (I use timelinemax for the initial tweens on each page) the point is different so the tween seems off balance compared to the original tween. I put a trace statement in my getNewPoint function and I noticed that it doesn't get recalled when I subsequently do additional _timeline.restart().

 

Now, I've had a look at the DynamicProps plug in, and I think my solution lies there, but I can't work out the syntax to get it working with a new dynamic point. I've tried this...

 

_timeline.insert( TweenMax.to(_over, 0, {alpha:0, transformAroundPoint:{dynamicProps:{point:getNewPoint}, scaleX:0.9, scaleY:0.9, shortRotation:{rotation:20}}}) )

 

or/and

 

_timeline.insert( TweenMax.to(_over, 0, {alpha:0, dynamicProps:{transformAroundPoint:{point:getNewPoint}, scaleX:0.9, scaleY:0.9, shortRotation:{rotation:20}}}) )

 

 

But both throw errors, and I'm a little bit unsure of the correct syntax or even if what I'm doing is possible. Any help is greatly appreciated, thanks.

 

Ken.

Link to comment
Share on other sites

Keep in mind that your timeline's values get recorded as soon as it gets created. if you do something like resize the stage after they have been recorded, the new positions aren't updated. In short, getNewPoint() only runs when the timeline is created, not when its playing.

 

Are you using LiquidStage? if so, I believe the liquidPositionPlugin was created for this very scenario:

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

 

 

if not, perhaps you can try to invalidate() your timeline when the stage gets resized. I'm not 100% certain that will work as I've never tried it.

 

As a side note I don't think dynamicProps was intended to by integrated with TransformAroundPoint like you have attempted.

 

Carl

Link to comment
Share on other sites

Thanks for your reply Carl,

 

I am aware of the Liquid Stage classes, but I'd already written all my stage resize code for this project before discovering them. I have used them on another project and they are extremely handy.

 

Thanks for the reply, I think I will have to restructure my app a little if I want the tween I'm after.

 

Cheers... Ken.

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