Share Posted October 27, 2020 Hello, I want to loop an object by an additional 140 px every second. This moves the element by 140 pixels, but then resets every second instead of moving from the current position. Any help is appreciated thanks! gsap.to(table, {duration:1, x:"-=140", ease:"none", repeat:-1}); 1 Link to comment Share on other sites More sharing options...
Share Posted October 27, 2020 Hey @Ron Itelman, Do you expect this to happen? See the Pen 06537b3b69db4021a00e36c6bbd3036a by mikeK (@mikeK) on CodePen If yoyo:true, every other repeat iteration will run in the opposite direction so that the tween appears to go back and forth. Happy repeating ... Mikel 1 Link to comment Share on other sites More sharing options...
Solution Solution Share Posted October 27, 2020 I'm not sure I understand your goal - do you want it to keep subtracting 140 from the x position over and over again? So, for example, it goes from 0 to -140, then -140 to -280, etc.? And with no ease? Wouldn't that just look like the element is constantly moving in that direction? You might want to look into repeatRefresh: true which will flush the recorded start/end values on each repeat, so in your example it'd do what I described. 2 Link to comment Share on other sites More sharing options...
Author Share Posted October 27, 2020 Thanks Jack, that is exactly what I wanted, a constant motion. Works perfectly. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now