def animate(self, animation, static, score, best, appear):
        """Handle animation."""

        # Create a surface of static parts in the animation.
        surface = pygame.Surface((self.game_width, self.game_height), 0)
        surface.fill(self.BACKGROUND)

        # Draw all static tiles.
        for y in range(self.COUNT_Y):
            for x in range(self.COUNT_X):
                x1, y1 = self.get_tile_location(x, y)
                x1 -= self.origin[0]
                y1 -= self.origin[1]
                surface.blit(self.tiles[static.get((x, y), 0)], (x1, y1))

        # Pygame clock for FPS control.
        clock = pygame.time.Clock()

        if score:
            score_label = self.label_font.render('+%d' % score, True, (119, 110, 101))
            w1, h1 = score_label.get_size()

        if best:
            best_label = self.label_font.render('+%d' % best, True, (119, 110, 101))
            w2, h2 = best_label.get_size()

        # Loop through every frame.
        for frame in range(self.ANIMATION_FRAMES):
            # Limit at 60 fps.
            clock.tick(60)

            # Pump events.
            pygame.event.pump()

            self.screen.blit(surface, self.origin)

            # Calculate animation progress.
            dt = (frame + 0.) / self.ANIMATION_FRAMES

            for tile in animation:
                self.screen.blit(self.tiles[tile.value], tile.get_position(dt))

            # Scale the images to be proportional to the square root allows linear size increase.
            scale = dt ** 0.5

            w, h = int(self.cell_width * scale) & ~1, int(self.cell_height * scale) & ~1

            for x, y, value in appear:
                self.screen.blit(self._scale_tile(value, w, h),
                                 self._center_tile(self.get_tile_location(x, y), (w, h)))

            # Draw the score boxes and get their location, if we are drawing scores.
            if best or score:
                (x1, y1), (x2, y2), w, h = self.draw_scores()
            if score:
                self.screen.blit(score_label, (x1 + (w - w1) / 2, y1 + (h - h1) / 2 - dt * h))
            if best:
                self.screen.blit(best_label, (x2 + (w - w2) / 2, y2 + (h - h2) / 2 - dt * h))

            pygame.display.flip()