Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
karpovsystems

Animation starts from the wrong position

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

×