Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseAnimationPlayer<A, T>

Abstract base class for animation player implementations.

Type parameters

Hierarchy

Implements

Index

Constructors

Protected constructor

  • Creates a new animation player for the given animation and calling the given draw callback for each animation frame.

    Parameters

    • animation: A

      The animation to play.

    • onDraw: function

      Callback to call on each frame update. This callback is responsible for actually showing the animation frame to the user.

        • (frame: T): void
        • Parameters

          • frame: T

          Returns void

    Returns BaseAnimationPlayer

Methods

getFrame

  • getFrame(): T

getHeight

  • getHeight(): number

getNextDelay

  • getNextDelay(): number

Protected getNextDelayInUnits

  • getNextDelayInUnits(animation: A): number
  • Returns the number of time units to wait before rendering the next frame.

    Parameters

    • animation: A

      The animation to play.

    Returns number

    The next delay in time units.

getSpeed

  • getSpeed(): number

getWidth

  • getWidth(): number

Protected init

  • init(animation: A): T
  • Initializes the player. Called for initialization when player is created and each time it is reset.

    Parameters

    • animation: A

      The animation to play.

    Returns T

    The base frame to start the animation with.

next

  • next(): void

Protected nextFrame

  • nextFrame(animation: A, currentFrame: T): T
  • Creates and returns the next frame in the animation.

    TODO Do we need a return value here?

    Parameters

    • animation: A

      The animation to play.

    • currentFrame: T

      The current frame.

    Returns T

    The next frame.

reset

  • reset(): void

setSpeed

  • setSpeed(speed: number): void

start

  • start(): void

stop

  • stop(): void

Generated using TypeDoc