ah- I mean you can do the same thing with a transition (less code I think)

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions