Jump to content
Search Community

Animation starts from the wrong position

karpovsystems 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

After killing animation and setting a new style, the new animation starts from the wrong position

 

Steps for reproducing:

  1. Create new tween let tween = TweenMax.to($test, 5, {x: 100});
  2. Kill the tween while animating tween.kill();
  3. Change target style $test.style.transform = 'translate3d(0,0,0)';
  4. Start new animation TweenMax.to($test, 5, {x: 100});

See the Pen bGbKdjZ by karpovsystems (@karpovsystems) on CodePen

Link to comment
Share on other sites

Hello karopvsystems and welcome to the GreenSock forums!

 

We recommend using clearProps over setting the transform property manually. GSAP keeps track of records internally for more accuracy (which is why setting it manually doesn't work in this case). 

 

See the Pen oNvyjGa?editors=0010 by GreenSock (@GreenSock) on CodePen

 

The reason why .kill() doesn't automatically call clearProps: "all" is because most people when killing an animation want it to remain in its current state.

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