Added support for animations.

This is not yet working as expected.
Merge conflicts fixed.