Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Ron Itelman

Continuous looping of x by current position

Go to solution Solved by GreenSock,

Recommended Posts

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});

Link to comment
Share on other sites

  • Solution

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. 

  • Like 2
Link to comment
Share on other sites

Thanks Jack, that is exactly what I wanted, a constant motion. Works perfectly.

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