Jump to content
Search Community

different timers not synced

court 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

function tweenFunction(options){
    TweenLite.to(element, timer, {left: left, top: top, ease:"Linear.easeNone", delay: delay,
        onComplete: function(){
            animateLeft = options.animateLeft || false;
            callLeft = options.callLeft || false;
            if(animateLeft) {options.callLeft()}
        },
     }); 
}


function leftGroup() {
var timer = 2.5;
var adjustedTime = 1.25;


    tweenFunction({element: assetA, leftVal: "38px", topVal: "121px", timer: timer, animateLeft: true, callLeft: LeftAssets});
  
    function LeftAssets() {
        tweenFunction({element: hydrogenB, leftVal: "116px", topVal: "39px", timer: timer}); //timer: adjustedTime 
        tweenFunction({element: hydrogenA, leftVal: "116px", topVal: "39px", timer: adjustedTime });
    }
 
I simplified what I am doing to make it simpler to post here (I might of missed something on the syntax, but my code runs just fine).
 
Basically I have a function that takes in objects that moves stuff aroud (I call these assets). In the LeftAssets function assetB and assetC must run off different timers (timer, adjustedTime). My problem is that when I set the different timers the tween that uses adjustedTime runs a couple of times and then settles in the tween position; the other one continues tweening normally. Not sure what is even causing this problem. 
Hope I made sense..
thanks all

 

Link to comment
Share on other sites

See the Pen owqGn by anon (@anon) on CodePen

 

Sorry to be such a pain in the ass, was not able to get it to work. Its pretty short and straight forward, not sure how to debug on codePen. If you can check it out and see if you can get it working, Ill let you know what is going wrong on my project

thanks..

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