Jump to content
Search Community

Repeat animation without setInterval

tilohi8071 test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

Hi there,

I need a simple animation: An element moves towards its starting point (x: 500), then for some time, this value changes randomly every second, and after about 10 seconds, the element moves towards its final point (x: 1000).

I tried to do this using the repeat property and chain calls, but it didn't work out well. Here's an example implementation using setTimeout and setInterval. Can someone help me refactor this using gsap properties and methods?

See the Pen OJBVZxM by coyibe2003 (@coyibe2003) on CodePen

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