code for animate