Handles the motion playback.

Emits

MotionManagerEvents

Hierarchy

Constructors

Properties

currentAudio?: HTMLAudioElement

Audio element of the current motion if a sound file is defined with it.

definitions: Partial<Record<string, Motion[]>>

Motion definitions copied from ModelSettings.

destroyed: boolean = false

Flags the instances has been destroyed.

expressionManager?: Cubism4ExpressionManager

Can be undefined if the settings defines no expression.

eyeBlinkIds: string[]
groups: { idle: "Idle" } = ...

Motion groups with particular internal usages. Currently there's only the idle field, which specifies the actual name of the idle motion group, so the idle motions can be correctly found from the settings JSON of various Cubism versions.

Type declaration

  • idle: "Idle"
lipSyncIds: string[]
motionDataType: "json" = 'json'

Indicates the content type of the motion files, varies in different Cubism versions. This will be used as xhr.responseType.

motionGroups: Partial<Record<string, (undefined | null | CubismMotion)[]>> = {}

The Motions. The structure is the same as definitions, initially each group contains an empty array, which means all motions will be undefined. When a Motion has been loaded, it'll fill the place in which it should be; when it fails to load, the place will be filled with null.

playing: boolean = false

Flags there's a motion playing.

queueManager: CubismMotionQueueManager = ...

The ModelSettings reference.

state: MotionState = ...

Maintains the state of this MotionManager.

tag: string

Tag for logging.

prefixed: string | boolean

Methods

  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

    Returns ListenerFn[]

  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Cubism4MotionManager

  • Add a listener for a given event.

    Parameters

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

    Returns Cubism4MotionManager

  • Add a one-time listener for a given event.

    Parameters

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

    Returns Cubism4MotionManager

  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Cubism4MotionManager

  • Starts a motion as given priority.

    Returns

    Promise that resolves with true if the motion is successfully started, with false otherwise.

    Parameters

    • group: string

      The motion group.

    • index: number

      Index in the motion group.

    • priority: MotionPriority = MotionPriority.NORMAL

      The priority to be applied.

    Returns Promise<boolean>

  • Updates parameters of the core model.

    Returns

    True if the parameters have been actually updated.

    Parameters

    • model: object

      The core model.

    • now: number

      Current time in milliseconds.

    Returns boolean

Generated using TypeDoc