 <p>To animate you'll need to define a starting state, and a target (or finished) state and an easing function to control the rate of change.</p> <p>Rather than start from scratch I'd suggest leveraging an existing solution, there is a LOT of code out there to help you do this.</p> <p>Check out: <a href="https://github.com/sole/tween.js" rel="nofollow">https://github.com/sole/tween.js</a></p>