LogoPixi’VN
coreClasses

Class: CubismMotionManager

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6152

Handles the motion playback for Live2D models. Responsible for loading, playing, and managing motion states and audio.

Emits

MotionManagerEvents

Extends

Constructors

Constructor

> new CubismMotionManager(parent): CubismMotionManager

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6163

Parameters

parent

CubismInternalModel

Returns

CubismMotionManager

Overrides

MotionManager.constructor

Properties

currentAnalyzer?

> optional currentAnalyzer?: AnalyserNode

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3434

Analyzer element for the current sound being played.

Inherited from

MotionManager.currentAnalyzer


currentAudio?

> optional currentAudio?: Sound

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3429

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

Inherited from

MotionManager.currentAudio


currentContext?

> optional currentContext?: AudioContext

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3439

Context element for the current sound being played.

Inherited from

MotionManager.currentContext


definitions

> abstract readonly definitions: Partial<Record<string, CubismSpec.Motion[]>>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6153

Motion definitions copied from ModelSettings.

Overrides

MotionManager.definitions


destroyed

> destroyed: boolean

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3449

Flags whether the instance has been destroyed.

Inherited from

MotionManager.destroyed


expressionManager?

> abstract optional expressionManager?: CubismExpressionManager

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6160

Expression manager for handling model expressions. Can be undefined if the settings define no expression.

Overrides

MotionManager.expressionManager


eyeBlinkIds

> eyeBlinkIds: string[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6161


groups

> abstract readonly groups: object

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6154

Motion groups with specific internal usages. Includes at least the 'idle' field.

idle

> readonly idle: "Idle"

Overrides

MotionManager.groups


lipSyncIds

> lipSyncIds: string[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6162


motionDataType

> abstract readonly motionDataType: "arraybuffer" = "arraybuffer"

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6157

Indicates the content type of the motion files, varies in different Cubism versions. Used as xhr.responseType.

Overrides

MotionManager.motionDataType


motionGroups

> motionGroups: Partial<Record<string, (Motion | undefined | null)[]>>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3419

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.

Inherited from

MotionManager.motionGroups


parent

> parent: InternalModel

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3454

Reference to the parent InternalModel.

Inherited from

MotionManager.parent


playing

> playing: boolean

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3444

Flags whether there is a motion currently playing.

Inherited from

MotionManager.playing


queueManager

> readonly queueManager: CubismMotionQueueManager

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6158


settings

> readonly settings: CubismModelSettings

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6159

The ModelSettings reference.

Overrides

MotionManager.settings


state

> state: MotionState

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3424

Maintains the state of this MotionManager.

Inherited from

MotionManager.state


tag

> tag: string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3378

Tag for logging.

Inherited from

MotionManager.tag


prefixed

> static prefixed: string | boolean

Defined in: node_modules/eventemitter3/index.d.ts:9

Inherited from

MotionManager.prefixed

Methods

_startMotion()

> abstract protected _startMotion(motion, onFinish?, ignoreParamIds?, loop?): number

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6166

Starts the Motion.

Parameters

motion

CubismMotion

The Motion to start.

onFinish?

(motion) => void

Optional callback when finished.

ignoreParamIds?

string[]

The ids to be ignored.

loop?

boolean

Whether the motion should loop.

Returns

number

An ID or token for the motion.

Overrides

MotionManager._startMotion


_stopAllMotions()

> abstract protected _stopAllMotions(): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6167

Stops all playing motions.

Returns

void

Overrides

MotionManager._stopAllMotions


addListener()

> addListener<T>(event, fn, context?): this

Defined in: node_modules/eventemitter3/index.d.ts:45

Type Parameters

T

T extends string | symbol

Parameters

event

T

fn

(...args) => void

context?

any

Returns

this

Inherited from

MotionManager.addListener


createMotion()

> abstract createMotion(data, group, definition): CubismMotion

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6168

Creates a Motion from the data.

Parameters

data

ArrayBuffer

Content of the motion file. The format must be consistent with MotionManager#motionDataType.

group

string

The motion group.

definition

Motion

The motion definition.

Returns

CubismMotion

The created Motion.

Overrides

MotionManager.createMotion


destroy()

> destroy(): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6173

Destroys the instance and releases all resources.

Returns

void

Emits

MotionManagerEvents.destroy

Overrides

MotionManager.destroy


emit()

> emit<T>(event, ...args): boolean

Defined in: node_modules/eventemitter3/index.d.ts:32

Calls each of the listeners registered for a given event.

Type Parameters

T

T extends string | symbol

Parameters

event

T

args

...any[]

Returns

boolean

Inherited from

MotionManager.emit


eventNames()

> eventNames(): (string | symbol)[]

Defined in: node_modules/eventemitter3/index.d.ts:15

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

Returns

(string | symbol)[]

Inherited from

MotionManager.eventNames


getMotionAndApplyExpression()

> protected getMotionAndApplyExpression(group, index, expression?): Promise<unknown>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3637

Loads a motion and applies the given expression with FORCE priority.

Parameters

group

string

The motion group.

index

number

The motion index.

expression?

string | number

Expression to apply (optional).

Returns

Promise<unknown>

The loaded motion, or null if not started.

Inherited from

MotionManager.getMotionAndApplyExpression


getMotionFile()

> abstract getMotionFile(definition): string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6169

Retrieves the motion's file path by its definition.

Parameters

definition

Motion

Motion definition.

Returns

string

The file path extracted from the given definition. Not resolved.

Overrides

MotionManager.getMotionFile


getMotionName()

> abstract protected getMotionName(definition): string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6170

Retrieves the motion's name by its definition.

Parameters

definition

Motion

Motion definition.

Returns

string

The motion's name.

Overrides

MotionManager.getMotionName


getSoundFile()

> abstract protected getSoundFile(definition): string | undefined

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6171

Retrieves the motion's sound file by its definition.

Parameters

definition

Motion

Motion definition.

Returns

string | undefined

The motion's sound file, or undefined.

Overrides

MotionManager.getSoundFile


init()

> protected init(options?): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6164

Should be called in the constructor of derived class to initialize options and setup motions.

Parameters

options?

MotionManagerOptions

Initialization options for the manager.

Returns

void

Overrides

MotionManager.init


initializeAudio()

> protected initializeAudio(audio, volume): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3490

Initializes audio playback and sets up audio analysis for lipsync.

Parameters

audio

Sound

The Sound to initialize.

volume

number

The playback volume (0-1).

Returns

void

Inherited from

MotionManager.initializeAudio


isFinished()

> abstract isFinished(): boolean

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6165

Checks if the motion playback has finished.

Returns

boolean

Overrides

MotionManager.isFinished


listenerCount()

> listenerCount(event): number

Defined in: node_modules/eventemitter3/index.d.ts:27

Return the number of listeners listening to a given event.

Parameters

event

string | symbol

Returns

number

Inherited from

MotionManager.listenerCount


listeners()

> listeners<T>(event): (...args) => void[]

Defined in: node_modules/eventemitter3/index.d.ts:20

Return the listeners registered for a given event.

Type Parameters

T

T extends string | symbol

Parameters

event

T

Returns

(...args) => void[]

Inherited from

MotionManager.listeners


loadMotion()

> loadMotion(group, index): Promise<CubismMotion | undefined>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3479

Loads a Motion in a motion group. Errors in this method will not be thrown, but be emitted with a "motionLoadError" event.

Parameters

group

string

The motion group.

index

number

Index in the motion group.

Returns

Promise<CubismMotion | undefined>

Promise that resolves with the Motion, or with undefined if it can't be loaded.

Emits

MotionManagerEvents.motionLoaded

Emits

MotionManagerEvents.motionLoadError

Inherited from

MotionManager.loadMotion


motionLastFrame()

> abstract motionLastFrame(group, index, expression?): Promise<boolean>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6174

Play the last frame of the given motion, optionally applying an expression.

Parameters

group

string

Motion group.

index

number

Motion index.

expression?

Expression to apply (optional).

expression?

string | number

Returns

Promise<boolean>

Promise resolving to true if successful.

Overrides

MotionManager.motionLastFrame


mouthSync()

> mouthSync(): number

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3560

Move the mouth for lipsync.

Returns

number

The current lipsync value.

Inherited from

MotionManager.mouthSync


off()

> off<T>(event, fn?, context?, once?): this

Defined in: node_modules/eventemitter3/index.d.ts:69

Type Parameters

T

T extends string | symbol

Parameters

event

T

fn?

(...args) => void

context?

any

once?

boolean

Returns

this

Inherited from

MotionManager.off


on()

> on<T>(event, fn, context?): this

Defined in: node_modules/eventemitter3/index.d.ts:40

Add a listener for a given event.

Type Parameters

T

T extends string | symbol

Parameters

event

T

fn

(...args) => void

context?

any

Returns

this

Inherited from

MotionManager.on


once()

> once<T>(event, fn, context?): this

Defined in: node_modules/eventemitter3/index.d.ts:54

Add a one-time listener for a given event.

Type Parameters

T

T extends string | symbol

Parameters

event

T

fn

(...args) => void

context?

any

Returns

this

Inherited from

MotionManager.once


removeAllListeners()

> removeAllListeners(event?): this

Defined in: node_modules/eventemitter3/index.d.ts:79

Remove all listeners, or those of the specified event.

Parameters

event?

string | symbol

Returns

this

Inherited from

MotionManager.removeAllListeners


removeListener()

> removeListener<T>(event, fn?, context?, once?): this

Defined in: node_modules/eventemitter3/index.d.ts:63

Remove the listeners of a given event.

Type Parameters

T

T extends string | symbol

Parameters

event

T

fn?

(...args) => void

context?

any

once?

boolean

Returns

this

Inherited from

MotionManager.removeListener


setupMotions()

> protected setupMotions(options?): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3469

Sets up motions from the definitions, and preloads them according to the preload strategy.

Parameters

options?

MotionManagerOptions

Options controlling which motions to preload.

Returns

void

Inherited from

MotionManager.setupMotions


speak()

> speak(sound, volume?): Promise<boolean>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3502

Only play sound with lip sync.

Parameters

sound

string

The audio url or base64 content.

volume?

Volume of the sound (0-1).

expression?

string | number

onError?

(e) => void

onFinish?

() => void

resetExpression?

boolean

volume?

number

Returns

Promise<boolean>

Promise that resolves with true if the sound is playing, false otherwise.

Inherited from

MotionManager.speak


startMotion()

> startMotion(group, index, priority?, sound?): Promise<boolean>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3525

Starts a motion with the given priority.

Parameters

group

string

The motion group.

index

number

Index in the motion group.

priority?

MotionPriority

The priority to be applied. Default: NORMAL (2).

sound?

MotionStartOptions

The audio url or base64 content.

Returns

Promise<boolean>

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

Inherited from

MotionManager.startMotion


startRandomMotion()

> startRandomMotion(group, priority?, sound?): Promise<boolean>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3540

Starts a random Motion as given priority.

Parameters

group

string

The motion group.

priority?

MotionPriority

The priority to be applied. Default: IDLE (1).

sound?

MotionStartRandomOptions

The audio url or base64 content.

Returns

Promise<boolean>

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

Inherited from

MotionManager.startRandomMotion


stopAllMotions()

> stopAllMotions(): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3548

Stops all playing motions as well as the sound.

Returns

void

Inherited from

MotionManager.stopAllMotions


stopSpeaking()

> stopSpeaking(): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3544

Stops current audio playback and lipsync.

Returns

void

Inherited from

MotionManager.stopSpeaking


update()

> update(model, now): boolean

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3555

Updates parameters of the core model.

Parameters

model

object

The core model.

now

number

Current time in milliseconds.

Returns

boolean

True if the parameters have been actually updated.

Inherited from

MotionManager.update


updateParameters()

> abstract protected updateParameters(model, now): boolean

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6172

Updates parameters of the core model.

Parameters

model

CubismModel

The core model.

now

number

Current time in milliseconds.

Returns

boolean

True if the parameters have been actually updated.

Overrides

MotionManager.updateParameters

On this page

EmitsExtendsConstructorsConstructorParametersparentReturnsOverridesPropertiescurrentAnalyzer?Inherited fromcurrentAudio?Inherited fromcurrentContext?Inherited fromdefinitionsOverridesdestroyedInherited fromexpressionManager?OverrideseyeBlinkIdsgroupsidleOverrideslipSyncIdsmotionDataTypeOverridesmotionGroupsInherited fromparentInherited fromplayingInherited fromqueueManagersettingsOverridesstateInherited fromtagInherited fromprefixedInherited fromMethods_startMotion()ParametersmotiononFinish?ignoreParamIds?loop?ReturnsOverrides_stopAllMotions()ReturnsOverridesaddListener()Type ParametersTParameterseventfncontext?ReturnsInherited fromcreateMotion()ParametersdatagroupdefinitionReturnsOverridesdestroy()ReturnsEmitsOverridesemit()Type ParametersTParameterseventargsReturnsInherited fromeventNames()ReturnsInherited fromgetMotionAndApplyExpression()Parametersgroupindexexpression?ReturnsInherited fromgetMotionFile()ParametersdefinitionReturnsOverridesgetMotionName()ParametersdefinitionReturnsOverridesgetSoundFile()ParametersdefinitionReturnsOverridesinit()Parametersoptions?ReturnsOverridesinitializeAudio()ParametersaudiovolumeReturnsInherited fromisFinished()ReturnsOverrideslistenerCount()ParameterseventReturnsInherited fromlisteners()Type ParametersTParameterseventReturnsInherited fromloadMotion()ParametersgroupindexReturnsEmitsEmitsInherited frommotionLastFrame()Parametersgroupindexexpression?expression?ReturnsOverridesmouthSync()ReturnsInherited fromoff()Type ParametersTParameterseventfn?context?once?ReturnsInherited fromon()Type ParametersTParameterseventfncontext?ReturnsInherited fromonce()Type ParametersTParameterseventfncontext?ReturnsInherited fromremoveAllListeners()Parametersevent?ReturnsInherited fromremoveListener()Type ParametersTParameterseventfn?context?once?ReturnsInherited fromsetupMotions()Parametersoptions?ReturnsInherited fromspeak()Parameterssoundvolume?expression?onError?onFinish?resetExpression?volume?ReturnsInherited fromstartMotion()Parametersgroupindexpriority?sound?ReturnsInherited fromstartRandomMotion()Parametersgrouppriority?sound?ReturnsInherited fromstopAllMotions()ReturnsInherited fromstopSpeaking()ReturnsInherited fromupdate()ParametersmodelnowReturnsInherited fromupdateParameters()ParametersmodelnowReturnsOverrides