Axel and Tweenlite

Wrote your own tutorial? Post tutorials here for others to learn from!

Axel and Tweenlite

Postby Ats » Fri Sep 13, 2013 9:44 am

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.
Last edited by Ats on Sun Sep 22, 2013 4:30 am, edited 3 times in total.
Ats
Master Sergeant
 
Posts: 33
Joined: Wed Mar 06, 2013 6:10 pm

Re: Axel and Tweenlite

Postby Ats » Thu Sep 19, 2013 4:53 am

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!
Ats
Master Sergeant
 
Posts: 33
Joined: Wed Mar 06, 2013 6:10 pm

Re: Axel and Tweenlite

Postby Ats » Sun Sep 22, 2013 4:32 am

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 :)
Ats
Master Sergeant
 
Posts: 33
Joined: Wed Mar 06, 2013 6:10 pm

Re: Axel and Tweenlite

Postby Arkeus » Sun Sep 22, 2013 11:15 am

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!
Image
User avatar
Arkeus
Site Admin
 
Posts: 363
Joined: Mon Mar 26, 2012 12:43 am


Return to User Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron