create_animation helper function