This is basically how jQuery and Angular do CSS animations. jQuery also does animations by calculating the tween positions, but, that’s going to be obsolete because the mobile browsers now support CSS animations.
The hard part about understanding CSS animations (for me) was getting the concepts. This example tries to break down the parts of the animation. Try it out, and then read the code and comments.