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
Extends
MotionManager<CubismMotion,CubismSpec.Motion>
Constructors
Constructor
> new CubismMotionManager(parent): CubismMotionManager
Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:6163
Parameters
parent
Returns
CubismMotionManager
Overrides
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
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
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
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
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
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
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
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
parent
> parent: InternalModel
Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3454
Reference to the parent InternalModel.
Inherited from
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
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
state
> state: MotionState
Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3424
Maintains the state of this MotionManager.
Inherited from
tag
> tag: string
Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:3378
Tag for logging.
Inherited from
prefixed
> static prefixed: string | boolean
Defined in: node_modules/eventemitter3/index.d.ts:9
Inherited from
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
_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
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
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
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
Overrides
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
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
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
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
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
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?
Initialization options for the manager.
Returns
void
Overrides
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
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
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
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
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
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
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
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
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
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
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
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?
Options controlling which motions to preload.
Returns
void
Inherited from
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
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?
The priority to be applied. Default: NORMAL (2).
sound?
The audio url or base64 content.
Returns
Promise<boolean>
Promise that resolves with true if the motion is successfully started, false otherwise.
Inherited from
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?
The priority to be applied. Default: IDLE (1).
sound?
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
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
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
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.