Jump to content
Search Community

Start one function twice with different params at same time

menno79 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

Hi all,

 

I'm freaked out by now, since I've spend quite some time on creating the following situation:

Create one function, which gets some params ( value and scope ) and make it run it twice at the same moment ( actually at a certain scrollingposition using superscrollorama) with different params.

 

What should I use and what would be the correct syntax?

 

At this moment I'm on my ipad so I don't have some example code. I'm hoping to get some helpful responses, but if it's important, I will update this topic soon with my example code...

 

Thanks already, folks!

 

All the best,

 

Menno

Link to comment
Share on other sites

Have you tried just adding two function calls at the same time? Seems to work fine to me:

var  somefunction = function(param1, param2) {
  // ...
}

var tl = new TimelineLite();
tl.call(somefunction, ["value1", "value2"]);
tl.call(somefunction, ["value3", "value4"]);

No idea about using Superscrollorama, but you can certainly add as many function calls at whatever times you want to a TimelineLite/Max. TimelineLite.call()

  • Like 2
Link to comment
Share on other sites

Hi,
 
Thank you for your swift response!
 
I think I did mix things up, since I was (indeed) able to fix it quite easy based on your comments.
If I recall correctly I was trying to make it work chaining a few '.add's in there.

 

Now I have this code, which is working like a charm:

controller.addTween($('#id1'),
    myTimelineMax
        .call(functionName, ["#id2", value1, value2])
        .call(functionName, ["#id3", value3, value4])
        .add(TweenMax.from(
            $('#id4'), 0.7, {css: {bottom: 0}, delay: 2})
        )
    ,0,0,true);

Thanks again! You made my day :)

 

Best regards,

 

Menno

 

  • Like 1
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...