I am building an app that displays a customizable avatar using overlayed divs with CSS background sprites that are gifs. Currently, I am setting the background image using inline component styling, like this:
<div id="head" style={{backgroundImage: `url(${headSheet})`}}/>
<div id="hat" style={{backgroundImage: `url(${hatSheet})`}}/>
This works most of the time, but occasionally when loading the page the gifs will not start at the same time and so the animations will not be in sync. I have tried these solutions:
but they did not work for me. They are also fairly old, so hopefully there is a more modern solution using React.