public interface

FrameScheduler

com.facebook.fresco.animation.frame.FrameScheduler
Known Indirect Subclasses

Class Overview

Frame scheduler used to calculate which frame to display for given animation times.

Summary

Constants
int FRAME_NUMBER_DONE
int NO_NEXT_TARGET_RENDER_TIME
Public Methods
abstract int getFrameNumberToRender(long animationTimeMs, long lastFrameTimeMs)
Get the frame number for the given animation time or FRAME_NUMBER_DONE if the animation is over.
abstract long getLoopDurationMs()
Get the loop duration of 1 full loop.
abstract long getTargetRenderTimeForNextFrameMs(long animationTimeMs)
For a given animation time, calculate the target render time for the next frame in ms.
abstract long getTargetRenderTimeMs(int frameNumber)
Get the target render time for the given frame number in ms.
abstract boolean isInfiniteAnimation()

Constants

public static final int FRAME_NUMBER_DONE

Constant Value: -1 (0xffffffff)

public static final int NO_NEXT_TARGET_RENDER_TIME

Constant Value: -1 (0xffffffff)

Public Methods

public abstract int getFrameNumberToRender (long animationTimeMs, long lastFrameTimeMs)

Get the frame number for the given animation time or FRAME_NUMBER_DONE if the animation is over.

Parameters
animationTimeMs the animation time to get the frame number for
lastFrameTimeMs the time of the last draw before
Returns

public abstract long getLoopDurationMs ()

Get the loop duration of 1 full loop.

Returns
  • the loop duration in ms

public abstract long getTargetRenderTimeForNextFrameMs (long animationTimeMs)

For a given animation time, calculate the target render time for the next frame in ms. If the animation is over, this will return NO_NEXT_TARGET_RENDER_TIME

Parameters
animationTimeMs the current animation time in ms
Returns
  • the target animation time in ms for the next frame after the given animation time or NO_NEXT_TARGET_RENDER_TIME if the animation is over

public abstract long getTargetRenderTimeMs (int frameNumber)

Get the target render time for the given frame number in ms.

Parameters
frameNumber the frame number to use
Returns
  • the target render time

public abstract boolean isInfiniteAnimation ()

Returns
  • true if the animation is infinite