Refactor of animation API.