But I want to make it a button so when someone taps on the icon, it spins with the CSS lines above (but removing “infinite”). I did a search for “css in javascript” but they are for simple things like changing a color. I don’t know how to add something more complex with multiple open/close curly braces like above.
Adding the class will start the animation. When the animation completes an animationend event will be emitted and you can then remove the class. Removing the class is necessary if you want to repeatedly trigger the animation. If you only want to trigger it once, you don’t need to remove the class.