Page 1 of 1

Axel and Tweenlite

PostPosted: Fri Sep 13, 2013 9:44 am
by Ats
Hi, today I'm playing with the addition of Tweenlite to Axel.
Some things works like a charm, some others don't...

Movement:
Code: Select all
TweenLite.to(sprite, 5, {x:10, y:20});

Alpha:
Code: Select all
TweenLite.to(sprite, 5, {alpha:0.5});

Scale:
Code: Select all
Instead of :
   TweenLite.to(sprite, 5, {scaleX:4, scaleY:4});

You have to write :
   TweenLite.to(sprite.scale, 5, {x:4, y:4});

Rotation:
Code: Select all
Instead of :
   TweenLite.to(sprite, 5, {rotation:180});

You have to write :
   TweenLite.to(sprite, 5, {angle:180});


Pause all Tweens (when you lose focus) :

Copy org/axgl/util/AxpauseState.as to make your new modified pause state.

In your new PauseFocus, import com.greensock.TweenMax (only TweenMax can pause everything, not TweenLite).
Then add :

Code: Select all
override public function create():void {
   (...)
   TweenMax.pauseAll();
}

and

Code: Select all
override public function dispose():void {
   super.dispose();
   TweenMax.resumeAll();
}


And to finish, replace the original pauseState by your new one in your main package :

Code: Select all
import src.state.PauseFocus; // Import your modified pauseState
(...)
override public function create():void {
   Ax.pauseState = PauseFocus;
}



Do anybody know how to make the pluggins work?
Thanks for your help.

Re: Axel and Tweenlite

PostPosted: Thu Sep 19, 2013 4:53 am
by Ats
So I found how to execute a rotation with TweenLite in AXEL. Just use angle instead of rotation.
I've updated the first post with that discovery. Now, to the pluggins!

Re: Axel and Tweenlite

PostPosted: Sun Sep 22, 2013 4:32 am
by Ats
I've added the Pause all Tweens (when you lose focus) explanations in the first post.
With all the discoveries I'm adding, maybe we should move this topic to the tutorial section :)

Re: Axel and Tweenlite

PostPosted: Sun Sep 22, 2013 11:15 am
by Arkeus
Agreed! Moved. I'm glad you've been able to find the solutions you need, as I have no experience with Tweenlite. I'm sure others will be able to get a lot out of this post!