Jump to content
Search Community

Kill infinite repeat, re-applies the duration

7linternational 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,

 

I have a tween that appears on click of an object fades in and starts to rotate infinitely with repeat = -1.
When I kill that tween and then re-click the object and and the tween re-starts it adds to the duration from the previous tween, so everytime I click and it begins to rotate its duration += previous-duration+duration

Code that fades in and starts to rotate object

TweenMax.to([".planet1UI>img"], 0.8, {
            autoAlpha: 1,
            delay: 1.5,
            onComplete: function() {
                TweenMax.to(".planet1UI>img", 4, { rotation: 360, ease: Linear.easeNone, repeat: -1, transformOrigin: "50% 50%" });
            }
        });


code that removes the rotation

TweenMax.set([".planet1UI>img", ".planet2UI>img"], { autoAlpha: 0 });
        TweenMax.killTweensOf([".planet1UI>img", ".planet2UI>img"], { rotation: true, transformOrigin: true });
        TweenMax.killChildTweensOf(".planet1UI");
        TweenMax.killChildTweensOf(".planet2UI");
        TweenMax.killAll();


So every time I restart the rotation it is 4seconds slower 

 

Any ideas?

I will add an codepen soon.

 

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