class_docstr: The foundation of all animations.
  
  Parameters
  ----------
  blocks : list of animatplot.animations.Block
      A list of blocks to be animated
  timeline : Timeline or 1D array, optional
      If an array is passed in, it will be converted to a Timeline.
      If not given, a timeline will be created using the length of the
      first block.
  fig : matplotlib figure, optional
      The figure that the animation is to occur on
  
  Attributes
  ----------
  animation
      a matplotlib animation returned from FuncAnimation
class_docstr_tok: ["The","foundation","of","all","animations",".","Parameters","--","--","--","--","--","blocks",":","list","of","animatplot.animations.Block","A","list","of","blocks","to","be","animated","timeline",":","Timeline","or","1D","array",",","optional","If","an","array","is","passed","in",",","it","will","be","converted","to","a","Timeline",".","If","not","given",",","a","timeline","will","be","created","using","the","length","of","the","first","block",".","fig",":","matplotlib","figure",",","optional","The","figure","that","the","animation","is","to","occur","on","Attributes","--","--","--","--","--","animation","a","matplotlib","animation","returned","from","FuncAnimation"]
code: def __init__(self, blocks, timeline=None, fig=None):
      if timeline is None:
          self.timeline = Timeline(range(len(blocks[0])))
      elif not isinstance(timeline, Timeline):
          self.timeline = Timeline(timeline)
      else:
          self.timeline = timeline
  
      _len_time = len(self.timeline)
      for block in blocks:
          if len(block) != _len_time:
              raise ValueError(
                  "All blocks must animate for the same amount of time"
              )
  
      self.blocks = blocks
      self.fig = plt.gcf() if fig is None else fig
      self._has_slider = False
      self._pause = False
  
      def animate(i):
          updates = []
          for block in self.blocks:
              updates.append(block._update(self.timeline.index))
          if self._has_slider:
              self.slider.set_val(self.timeline.index)
          self.timeline._update()
          return updates
  
      self.animation = FuncAnimation(
          self.fig,
          animate,
          frames=self.timeline._len,
          interval=1000 / self.timeline.fps,
      )
  
file_path: animatplot/animatplot/animation.py
imports: from matplotlib.animation import FuncAnimation, PillowWriter
  from matplotlib.widgets import Button, Slider
  import matplotlib.pyplot
  import numpy
  from animatplot import Timeline
label_desc: Use image node_id 1 to create a new Animation object  with example: obj = Animation(blocks, timeline, fig)