title: Add delay between specific frames of a matplotlib animation
body: <p>I want to create an animation in <code>matplotlib</code> using <a href="https://matplotlib.org/api/_as_gen/matplotlib.animation.FuncAnimation.html" rel="nofollow noreferrer"><code>FuncAnimation</code></a>. The animation contains various "stages" which I would like to separate (emphasize) by adding an extra delay to the interval between the two corresponding frames. Consider the following example code that draws five circles and the drawing of each two consecutive circles should be separated by 1 second:</p>
  
  <pre><code>import time
  from matplotlib.animation import FuncAnimation
  import matplotlib.pyplot as plt
  import numpy as np
  
  f, ax = plt.subplots()
  ax.set_xlim([-5, 5])
  ax.set_ylim([-5, 5])
  
  radius = 1
  dp = 2*np.pi / 50
  circles = [[(radius, 0)]]
  plots = ax.plot([radius], [0])
  
  def update(frame):
      global radius
  
      if frame % 50 == 0:
          radius += 1
          circles.append([(radius, 0)])
          plots.extend(ax.plot([radius], [0]))
          # I want to add a delay here, i.e. before the drawing of a new circle starts.
          # This works for `plt.show()` however it doesn't when saving the animation.
          time.sleep(1)
      angle = (frame % 50) * dp
      circles[-1].append((radius * np.cos(angle), radius * np.sin(angle)))
      plots[-1].set_data(*zip(*circles[-1]))
      return plots[-1]
  
  animation = FuncAnimation(f, update, frames=range(1, 251), interval=50, repeat=False)
  
  ### Uncomment one of the following options.
  # animation.save('test.mp4', fps=20)
  # with open('test.html', 'w') as fh:
  #     fh.write(animation.to_html5_video())
  # plt.show()
  </code></pre>
  
  <p>This works when playing the animation via <code>plt.show()</code> however it doesn't work when saving as <code>.mp4</code> or HTML5 video. This makes sense since, according to the documentation, the FPS determines the frame delay for mp4 video and the <code>interval</code> parameter is used for HTML5 video. Then frames are just played one after another (ignoring any compute time as well).</p>
  
  <p>So how can I add a delay that will be retained upon saving the animation?</p>