Jump to content
Search Community

How to simply increment movement

yan_rez test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

 

Welcome to the forums @yan_rez

 

What you're lokking for is

repeat, repeatDelay and repeatRefresh

 

repeat and repeatDelay are pretty self-explanatory, I think.

repeatRefresh set to true makes sure the next repeat starts from the last tweened to position instead of the start.

 

gsap.to('.box', { delay: 1, duration: 1, x: "+=20", repeat: 49, repeatDelay: 1, repeatRefresh: true })

 

See the Pen 3e142c49e870b416826d85e8c318393e by akapowl (@akapowl) on CodePen

 

  • Like 3
Link to comment
Share on other sites

  • Solution

🤔 I actually don't know if there is a way to reverse that.

Maybe someone else with a little bit more insight than me can give you a definitive answer on that though.

 

What you could definitely do instead is create multiple individual tweens in a for-loop ( for whatever amount you want things to repeat ) and add those tweens to a timeline - that would then be easily reversable. Something like this

 

See the Pen b3c8463d504a4efcec70ff3dce300108 by akapowl (@akapowl) on CodePen

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