def play(self):
        """Starts an animation playing."""
        if self.state == PygAnimation.PLAYING:
            pass  # nothing to do

        elif self.state == PygAnimation.STOPPED:  # restart from beginning of animation
            self.index = 0  # first image in list
            self.elapsed = 0
            self.playingStartTime = time.time()
            self.elapsedStopTime = self.endTimesList[-1]  # end of last animation image time
            self.nextElapsedThreshold = self.endTimesList[0]
            self.nIterationsLeft = self.nTimes  # typically 1

        elif self.state == PygAnimation.PAUSED:  # restart where we left off
            self.playingStartTime = time.time() - self.elapsedAtPause  # recalc start time
            self.elapsed = self.elapsedAtPause
            self.elapsedStopTime = self.endTimesList[-1]  # end of last animation image time
            self.nextElapsedThreshold = self.endTimesList[self.index]

        self.state = PygAnimation.PLAYING
Starts an animation playing.