I've made an animation which consists of a cabin and a few clouds floating in the sky. I wanna loop the entire animation but just can't find the proper way to implement this. This is my current approach.
const { rive, RiveComponent } = useRive({
src: Cabin,
autoplay: true,
onStop: () => {
if (window.location.href === "http://localhost:8000/profile") {
// check the url to prevent error when switching pages, which also makes the animation stop
rive.play()
}
}
})
It works for now, but I still wonder whether there is any cleaner way to loop animation or not.