refactor AnimatePlayer.as