Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
timaging

Can't seem to do TweenLite on a variable?

Recommended Posts

Hi,

I'm trying to get an animation under 40k, and I think it might be because I have to load TweenMax for my initial variable.

 

I am doing this for import:

 

import com.greensock.*;

import com.greensock.easing.*;

 

 

but this doesn't work if I change TweenMax to TweenLite:

 

var hideStuff:Array = [txt01, txt02, logo, line];

TweenMax.allTo(hideStuff, 0, {_alpha:0});

 

 

Is there a way to do this with TweenLite, so everything that's compiled is TweenLite?

 

Thanks

Dave

 

Link to comment
Share on other sites

Hi Dave,

 

TweenLite does not have an allTo() method, which is one of the ways we keep it Lite ;)

 

Also, please be aware that in the latest version of GSAP allTo() has been deprecated (still works) but we recommend you use the newer TweenMax.staggerTo().

I noticed you are using allTo() though without a stagger parameter, so that it seems you are setting the opacity of all the elements at once.

 

In this case if you re using v12, please be aware the TweenLite can accept an array for the target of a to() tween like

TweenLite.to(hideStuff, 0, {_alpha:0});  //v12 ONLY

Also if your tweens have no duration you can use set() instead

TweenLite.set(hideStuff, {_alpha:0}); //v12 ONLY

If you are using a very old version of v11 (last update was 2 years ago) you can then use a loop

 

If you want to do the same thing as your code above in AS2 with TweenLite you will need to use a loop.

for(i=0; i<hideStuff.length; i++){
  TweenLite.to(hideStuff[i], 0, {_alpha:0});
}

Read more about TweenLite.to() and set() in the v12 docs: http://greensock.com/asdocs/com/greensock/TweenLite.html

Download GSAP v12 here: http://greensock.com/gsap-as

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