def update(self):
        """Internal method which updates this animation to whatever the current
        frame should be and marks this element as dirty so it will be picked up
        when the display is refreshed.
        """

        if not self.playing:
            return

        current_time = time.time()

        if not self.next_frame_time:
            # This animation is just starting up
            self.last_frame_time = current_time
            self.next_frame_time = current_time

        if self.next_frame_time <= current_time:  # need to show a frame
            # Figure out how many frames ahead we should be.
            # Look at how much time has passed since the last frame was
            # shown and divide that by secs_per_frame, then convert to int
            # so we just get the whole number part.
            num_frames = int((current_time - self.last_frame_time) /
                             self.secs_per_frame)

            self.last_frame_time = self.next_frame_time

            if num_frames > 1:  # we're behind

                if self.drop_frames:
                    # If we're dropping frames, then just set the next frame
                    # time to show when it ordinarily should. This will keep
                    # the playback speed consistent.

                    self.next_frame_time = current_time + self.secs_per_frame

                    #self.log.warning('Dropped %s frame(s)', num_frames-1)

                else:  # don't drop any frames
                    # If we're not dropping frames, we want to play them back
                    # as fast as possible to hopefully catch up, so we set the
                    # next frame time to the current time so we show another
                    # frame on the next loop.
                    self.next_frame_time = current_time

                    #self.log.warning('Animation is set to not drop frames, '
                    #                 'but is currently %s frame(s) behind',
                    #                 num_frames-1)

                    # Only advance 1 frame since we're not dropping any.
                    num_frames = 1

            else:  # we're on time
                self.next_frame_time = current_time + self.secs_per_frame

            self.jump(num_frames, show_now=True)

            self.decorate()
            return True

        if self.decorate():
            return True

        return False
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/elements/animation.py/AnimationDisplayElement.update/original