add function for animation