Reworked animation framework. Still needs more fixing.