I've got a script that shows an image when we are attacked by a monster. The image is initially set to display="none", but switches to display="" when a monster appears.
What I'm looking to do is make the image rotate 360° when it changes from display:none to display.
Here's the HTML:
<img id="monster" style="display:none;">
And here's the JavaScript:
var skinMonster = document.getElementById('monster');
During a fight, I use skinMonster.style.display="";
Once the battle is over, I use
skinMonster.style.display="none";
The challenge I'm facing is detecting the moment when the style changes so I can animate the picture rotation.