Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Animation

Represents an animation.

Hierarchy

  • EventEmitter
    • Animation

Index

Constructors

constructor

  • new Animation(name?: undefined | string): Animation
  • Creates a new animation with the specified name.

    Parameters

    • Optional name: undefined | string

      Name for the animation.

    Returns Animation

Properties

Private Optional _ticker

_ticker: PIXI.Ticker

Private Optional _update

_update: undefined | ((...params: any[]) => void)

Abstract duration

duration: number

The duration (in seconds) of this animation.

loop

loop: boolean = false

A value indicating if the animation is looping.

Optional name

name: undefined | string

Name for the animation.

Abstract position

position: number

The current position (in seconds) of this animation.

speed

speed: number = 1

The speed that the animation will play at.

Methods

addListener

  • addListener(event: string | symbol, fn: Function, context?: any): this
  • Alias method for on

    Parameters

    • event: string | symbol
    • fn: Function
    • Optional context: any

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    • Rest ...args: any[]

      Arguments that are passed to registered listeners

    Returns boolean

    true if the event had listeners, else false.

eventNames

  • eventNames(): Array<string | symbol>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<string | symbol>

listenerCount

  • listenerCount(event: string | symbol): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns number

listeners

  • listeners(event: string | symbol): Array<Function>
  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns Array<Function>

off

  • off(event: string | symbol, fn?: Function, context?: any, once?: undefined | false | true): this
  • Alias method for removeListener

    Parameters

    • event: string | symbol
    • Optional fn: Function
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

on

  • on(event: string | symbol, fn: Function, context?: any): this
  • Add a listener for a given event.

    Parameters

    • event: string | symbol

      The event name.

    • fn: Function

      The listener function.

    • Optional context: any

    Returns this

    this.

once

  • once(event: string | symbol, fn: Function, context?: any): this
  • Add a one-time listener for a given event.

    Parameters

    • event: string | symbol

      The event name.

    • fn: Function

      The listener function.

    • Optional context: any

    Returns this

    this.

play

  • play(ticker?: Ticker): void
  • Starts playing the animation using the specified ticker.

    Parameters

    • Default value ticker: Ticker = PIXI.Ticker.shared

      The ticker to use for updating the animation. If a ticker is not given, the shared ticker will be used.

    Returns void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

      The event name.

    Returns this

    this.

removeListener

  • removeListener(event: string | symbol, fn?: Function, context?: any, once?: undefined | false | true): this
  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol

      The event name.

    • Optional fn: Function

      Only remove the listeners that match this function.

    • Optional context: any

      Only remove the listeners that have this context.

    • Optional once: undefined | false | true

      Only remove one-time listeners.

    Returns this

    this.

stop

  • stop(): void

update

  • update(delta: number): void
  • Updates the animation by the specified delta time.

    Parameters

    • delta: number

      The time in seconds since last frame.

    Returns void

Generated using TypeDoc