Jump to content
Search Community

TweenMax is larger than Fl tranistion

ganesh test
Moderator Tag

Recommended Posts

Hi,

I am new to Tweenmax and tweenlite. I hv heard that its lighter and faster. So, I thought I should use them in my project where I am currently using fl.tranistions

 

I am developing my project in flashdevelop. But before using tweenmax in my main file I tried it on a small swf which I will import later on my main swf.

 

When I was using fl transition package I had to import three classes

import fl.transition.tween

import fl.transition.easings*;

import fl.transition.tweenEvent;

 

and the generated swf file size was 6kb

 

Later when I replaced fl transition with just one line of code

 

import com.greensock.TweenMax

and then the generated swf file became 38kb

 

But the loading time for both files is almost same fl.transtion loads in 9sec and tweenmax loades in 11 sec. AstionScript 3. I am using gprs connection (200kbps)

 

tweenmax

fl.transition

test.zip

Link to comment
Share on other sites

There are 3 variants of the GreenSock tweening classes:

  1. TweenNano: The smallest kb (around 2kb). It handles basic tweening (much better than Adobe's Tween class).
  2. TweenLite: Arguably the most popular tweening engine because it's very lightweight but has a lot more features than TweenNano and allows plugins that add features easily. I would highly recommend you use TweenLite instead of TweenNano if you can afford the extra 5kb-ish. It definitely gives you the best "bang for the buck"
  3. TweenMax: The most feature-rich flavor that extends TweenLite and automatically activates a bunch of useful plugins. That's why the file size is so much bigger - it is for those who are more concerned about full features rather than file size. Since it activates a bunch of plugins, it adds the kb of all those too. For a list, see the Plugin Explorer at http://www.greensock.com/tweenlite/#plugins. For example, it activates BezierPlugin, all the filter plugins, AutoAlphaPlugin, TintPlugin, and LOTS more.

All of the engines above are from GreenSock and use the EXACT same syntax.

TweenNano.to(mc, 1, {x:100, y:200, ease:Elastic.easeOut});
TweenLite.to(mc, 1, {x:100, y:200, ease:Elastic.easeOut});
TweenMax.to(mc, 1, {x:100, y:200, ease:Elastic.easeOut});

 

The difference is that each one adds more features. For example, TweenNano cannot tween filters, Beziers, tint, etc. TweenLite can as long as you activate those specific plugins. TweenMax does all that plus adds features like repeat, yoyo, repeatDelay, and more.

 

The whole system is meant to offer a very robust set of tools that you can pick and choose from.

 

Adobe's Tween class is extremely slow under pressure and it doesn't come anywhere close to even TweenNano in terms of features, much less TweenMax. Then there are the timeline classes that can revolutionize your animation workflow. I won't confuse you by talking about those yet. My point is that the GreenSock Animation Platform is intended to be a professional-grade suite, not just a basic [slow] class that tweens numeric properties like Adobe's Tween class.

 

Does that clear things up? Switch to TweenLite or TweenNano and you should see a big drop in the file size.

  • Like 1
Link to comment
Share on other sites

There are 3 variants of the GreenSock tweening classes:

  1. TweenNano: The smallest kb (around 2kb). It handles basic tweening (much better than Adobe's Tween class).
     
  2. TweenLite: Arguably the most popular tweening engine because it's very lightweight but has a lot more features than TweenNano and allows plugins that add features easily. I would highly recommend you use TweenLite instead of TweenNano if you can afford the extra 5kb-ish. It definitely gives you the best "bang for the buck"
     
  3. TweenMax: The most feature-rich flavor that extends TweenLite and automatically activates a bunch of useful plugins. That's why the file size is so much bigger - it is for those who are more concerned about full features rather than file size. Since it activates a bunch of plugins, it adds the kb of all those too. For a list, see the Plugin Explorer at http://www.greensock...nlite/#plugins. For example, it activates BezierPlugin, all the filter plugins, AutoAlphaPlugin, TintPlugin, and LOTS more.

All of the engines above are from GreenSock and use the EXACT same syntax.

TweenNano.to(mc, 1, {x:100, y:200, ease:Elastic.easeOut});
TweenLite.to(mc, 1, {x:100, y:200, ease:Elastic.easeOut});
TweenMax.to(mc, 1, {x:100, y:200, ease:Elastic.easeOut});

 

The difference is that each one adds more features. For example, TweenNano cannot tween filters, Beziers, tint, etc. TweenLite can as long as you activate those specific plugins. TweenMax does all that plus adds features like repeat, yoyo, repeatDelay, and more.

 

The whole system is meant to offer a very robust set of tools that you can pick and choose from.

 

Adobe's Tween class is extremely slow under pressure and it doesn't come anywhere close to even TweenNano in terms of features, much less TweenMax. Then there are the timeline classes that can revolutionize your animation workflow. I won't confuse you by talking about those yet. My point is that the GreenSock Animation Platform is intended to be a professional-grade suite, not just a basic [slow] class that tweens numeric properties like Adobe's Tween class.

 

Does that clear things up? Switch to TweenLite or TweenNano and you should see a big drop in the file size.

 

 

Thank you very much for your beautiful explanation..I am also very much interest to like greensock as I have already faced some issues with fl transitions.

 

Well, if you don't mind will you help me once more.

what I want to achieve with greensock is an yoyo function. but yoyo is only available in tweenmax

 

So, is there any way to repeat(loop) the same animation as soon as it finishes just by using tweennano or tweenlite. I wont mind to write few extra lines of code. But I just want to see if it can be done or not

Link to comment
Share on other sites

Yes, you can make a TweenLite repeat and yoyo by using an onComplete callback like so:

 

var myTween:TweenLite = TweenLite.to(mc, 1, {x:200, onComplete:repeat});

function repeat(){
myTween.reverse();
}

 

You can also use an onreverseComplete callback to assist in repeating multiple times.

Link to comment
Share on other sites

Yes, you can make a TweenLite repeat and yoyo by using an onComplete callback like so:

 

var myTween:TweenLite = TweenLite.to(mc, 1, {x:200, onComplete:repeat});

function repeat(){
myTween.reverse();
}

 

You can also use an onreverseComplete callback to assist in repeating multiple times.

 

Wow, thanks

I also used tweenlite but in lengthier way using if else. But your code is the smartest one, I will replace my code with this one..

And I also have started using tweenlite in my main project too

 

Thanks a lot

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