Jump to content
Search Community

tweenmax.set() callback

masq test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello there again!

 

I use TweenMax.set() to set properties like opacity and transform(x,y,rotate,scale(x,y)) for IE6-8, and it works like charm, everything is perfect!

 

But I have one issues, which I don't know how to solve. The life cycle of my page:

  1. Set DOM values via MVC engine
  2. Wait until $(window).load() and then fadeIn() page

Problem is TweenMax.set() executes on slow computers after load is complete and then user needs to wait like 2-3 seconds until element by element is positioned for him. Basically it look like mess.

 

What I would want is to know when TweenMax actually sets the values and after that I show content to the user.

 

Is it possible, has anyone ever had this problem?

 

Sincerely,

Masq

Link to comment
Share on other sites

Just so I'm clear, are you asking how to find out when the TweenMax.set() has completed? If so, just use an onComplete:

TweenMax.set(element, {opacity:0, x:100, y:200, rotation:30, onComplete:yourFunction});
function yourFunction() {
    console.log("this gets called when the set has finished, which is typically immediately");
}

Or, if you want to know when a whole group of set() calls has completed, you can put them into a TimelineLite that has an onComplete:

var tl = new TimelineLite({onComplete:yourFunction});
tl.set(e1, {x:100})
  .set(e2, {y:200})
  .set(e3, {rotation:30});
...

Does that help?

  • Like 1
Link to comment
Share on other sites

Hello again.

 

Sorry for my ignorance, I just thought that set wouldn't have a callback just because it's not an animation type function.

 

And yes, the second set of code is the actuall solution for my problem, because I have lot's of elements that are needed to be set :)

 

Big thanks and sorry for silly question. Reason why I asked is that google doesn't really showed this question and I wanted others to be able to find this one when searched :)

 

Regards,

Masq

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