Conversion to matplotlib.animation.FuncAnimation