Refactor animation using key frame approach