Popmotion has a nice API for defining animations, and some actions include a property to loop the action:
.
This will replay the animation for… Infinity:
https://codepen.io/tyronetudehope/pen/dBWPwV
However, with more complex animations, we can make use of the Action's start method callbacks. For example, if we'd like to create an animation which fades something in, displays it for a few seconds, then fades out again, and repeat ad infinitum, we can wrap it in a function and which calls itself from the complete()
function:
const animation =
const
https://codepen.io/tyronetudehope/pen/JQNdjy