Skip to content
Advertisement

How to make animation() endless

I have an element which should be animated all the time. The animated element has such CSS properties:

JavaScript

I can only move the element to a particular way, like this:

JavaScript

But this will just animated for 2000px my element has an endless width.

UPDATE:

ALL 7.5 Sec. #world become bigger.

FIDDLE

Advertisement

Answer

You can have a recursive function:

JavaScript

This will continue to move #world to the right, 1 pixel per millisecond.

With a step callback:

JavaScript

Good luck!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement