untitled-pixi-live2d-engine 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "untitled-pixi-live2d-engine",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "PixiJS v8 Live2D Engine | Supports Cubism 2-5 SDK | Lip-sync & Parallel Motion",
5
5
  "packageManager": "pnpm@10.26.2",
6
6
  "main": "dist/index.js",
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v6.11.0
2
2
 
3
- import { Sound } from '@pixi/sound';
3
+ import { Sound, SoundLibrary } from '@pixi/sound';
4
4
  import { Bounds, Container, EventEmitter, ExtensionType, FederatedPointerEvent, GlRenderingContext, InstructionSet, Matrix, ObservablePoint, Point, RenderLayer, Renderer, Texture, Ticker, Transform } from 'pixi.js';
5
5
 
6
6
  declare class Live2DModelWebGL {
@@ -3116,6 +3116,11 @@ export interface InternalModelOptions extends MotionManagerOptions {
3116
3116
  * @default 0.4
3117
3117
  */
3118
3118
  lipSyncWeight?: number;
3119
+ /**
3120
+ * Whether to enable automatic eye blinking between motions.
3121
+ * @default true
3122
+ */
3123
+ eyeBlink?: boolean;
3119
3124
  /**
3120
3125
  * Whether to use Cubism's high precision clipping mask rendering.
3121
3126
  * Only supported by Cubism 3/4/5 models.
@@ -3325,6 +3330,20 @@ export interface MotionManagerOptions {
3325
3330
  */
3326
3331
  checkMotionConsistency?: boolean;
3327
3332
  }
3333
+ export interface MotionStartOptions {
3334
+ sound?: string;
3335
+ volume?: number;
3336
+ expression?: number | string;
3337
+ resetExpression?: boolean;
3338
+ onFinish?: () => void;
3339
+ onError?: (e: Error) => void;
3340
+ ignoreParamIds?: string[];
3341
+ /**
3342
+ * Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3343
+ */
3344
+ loop?: boolean;
3345
+ }
3346
+ export type MotionStartRandomOptions = Omit<MotionStartOptions, "ignoreParamIds">;
3328
3347
  /**
3329
3348
  * Indicates how the motions will be preloaded.
3330
3349
  */
@@ -3490,17 +3509,10 @@ export declare abstract class MotionManager<Motion = unknown, MotionSpec = unkno
3490
3509
  * @param onFinish - Callback when playback finishes.
3491
3510
  * @param onError - Callback when playback errors.
3492
3511
  * @param ignoreParamIds - The ids to be ignored.
3512
+ * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3493
3513
  * @return Promise that resolves with true if the motion is successfully started, false otherwise.
3494
3514
  */
3495
- startMotion(group: string, index: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, ignoreParamIds }?: {
3496
- sound?: string;
3497
- volume?: number;
3498
- expression?: number | string;
3499
- resetExpression?: boolean;
3500
- onFinish?: () => void;
3501
- onError?: (e: Error) => void;
3502
- ignoreParamIds?: string[];
3503
- }): Promise<boolean>;
3515
+ startMotion(group: string, index: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, ignoreParamIds, loop }?: MotionStartOptions): Promise<boolean>;
3504
3516
  /**
3505
3517
  * Starts a random Motion as given priority.
3506
3518
  * @param group - The motion group.
@@ -3512,16 +3524,10 @@ export declare abstract class MotionManager<Motion = unknown, MotionSpec = unkno
3512
3524
  * @param crossOrigin - Cross origin setting.
3513
3525
  * @param onFinish - Callback when playback finishes.
3514
3526
  * @param onError - Callback when playback errors.
3527
+ * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3515
3528
  * @return Promise that resolves with true if the motion is successfully started, false otherwise.
3516
3529
  */
3517
- startRandomMotion(group: string, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError }?: {
3518
- sound?: string;
3519
- volume?: number;
3520
- expression?: number | string;
3521
- resetExpression?: boolean;
3522
- onFinish?: () => void;
3523
- onError?: (e: Error) => void;
3524
- }): Promise<boolean>;
3530
+ startRandomMotion(group: string, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, loop }?: MotionStartRandomOptions): Promise<boolean>;
3525
3531
  /**
3526
3532
  * Stops current audio playback and lipsync.
3527
3533
  */
@@ -3589,11 +3595,12 @@ export declare abstract class MotionManager<Motion = unknown, MotionSpec = unkno
3589
3595
  * @param motion - The Motion to start.
3590
3596
  * @param onFinish - Optional callback when finished.
3591
3597
  * @param ignoreParamIds - The ids to be ignored.
3598
+ * @param loop - Whether the motion should loop.
3592
3599
  * @returns An ID or token for the motion.
3593
3600
  * @protected
3594
3601
  * @abstract
3595
3602
  */
3596
- protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void, ignoreParamIds?: string[]): number;
3603
+ protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void, ignoreParamIds?: string[], loop?: boolean): number;
3597
3604
  /**
3598
3605
  * Stops all playing motions.
3599
3606
  * @protected
@@ -3899,6 +3906,10 @@ export declare class SoundManager {
3899
3906
  static audios: Sound[];
3900
3907
  static analysers: AnalyserNode[];
3901
3908
  static contexts: AudioContext[];
3909
+ protected static aliases: WeakMap<Sound, {
3910
+ alias: string;
3911
+ library: SoundLibrary;
3912
+ }>;
3902
3913
  protected static _volume: number;
3903
3914
  /**
3904
3915
  * Global volume that applies to all the sounds.
@@ -3918,13 +3929,13 @@ export declare class SoundManager {
3918
3929
  * @param onFinish - Callback invoked when the playback has finished.
3919
3930
  */
3920
3931
  static play(audio: Sound, onFinish?: () => void): void;
3921
- static addAnalyzer(audio: Sound, context: AudioContext): AnalyserNode;
3932
+ static addAnalyzer(audio: Sound, context: AudioContext): AnalyserNode | undefined;
3922
3933
  /**
3923
3934
  * Get volume for lip sync
3924
3935
  * @param analyser - An analyzer element.
3925
3936
  * @return Returns value to feed into lip sync
3926
3937
  */
3927
- static analyze(analyser: AnalyserNode): number;
3938
+ static analyze(analyser?: AnalyserNode): number;
3928
3939
  /**
3929
3940
  * Disposes an audio element and removes it from {@link audios}.
3930
3941
  * @param audio - An audio element.
@@ -4448,15 +4459,17 @@ export declare class Live2DModel<IM extends InternalModel = InternalModel> exten
4448
4459
  * @param [options.resetExpression=true] - Reset the expression to default after the motion is finished.
4449
4460
  * @param [options.onFinish] - Callback function when speaking completes.
4450
4461
  * @param [options.onError] - Callback function when an error occurs.
4462
+ * @param [options.loop] - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
4451
4463
  * @return Promise that resolves with true if the motion is successfully started, with false otherwise.
4452
4464
  */
4453
- motion(group: string, index?: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError }?: {
4465
+ motion(group: string, index?: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, loop }?: {
4454
4466
  sound?: string;
4455
4467
  volume?: number;
4456
4468
  expression?: number | string;
4457
4469
  resetExpression?: boolean;
4458
4470
  onFinish?: () => void;
4459
4471
  onError?: (e: Error) => void;
4472
+ loop?: boolean;
4460
4473
  }): Promise<boolean>;
4461
4474
  motionLastFrame(group: string, id: number, { expression }?: {
4462
4475
  expression?: number | string;
@@ -4995,7 +5008,7 @@ export declare class CubismLegacyMotionManager extends MotionManager<Live2DMotio
4995
5008
  getMotionFile(definition: Cubism2Spec.Motion): string;
4996
5009
  protected getMotionName(definition: Cubism2Spec.Motion): string;
4997
5010
  protected getSoundFile(definition: Cubism2Spec.Motion): string | undefined;
4998
- protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[]): number;
5011
+ protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[], _loop?: boolean): number;
4999
5012
  protected _stopAllMotions(): void;
5000
5013
  protected updateParameters(model: Live2DModelWebGL, _now: DOMHighResTimeStamp): boolean;
5001
5014
  destroy(): void;
@@ -5008,7 +5021,7 @@ export declare class CubismLegacyParallelMotionManager extends ParallelMotionMan
5008
5021
  constructor(parent: CubismLegacyInternalModel);
5009
5022
  isFinished(): boolean;
5010
5023
  protected getMotionName(definition: Cubism2Spec.Motion): string;
5011
- protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[]): number;
5024
+ protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[], _loop?: boolean): number;
5012
5025
  protected _stopAllMotions(): void;
5013
5026
  protected updateParameters(model: Live2DModelWebGL, _now: DOMHighResTimeStamp): boolean;
5014
5027
  destroy(): void;
@@ -6114,7 +6127,7 @@ export declare class CubismMotionManager extends MotionManager<CubismMotion, Cub
6114
6127
  constructor(parent: CubismInternalModel);
6115
6128
  protected init(options?: MotionManagerOptions): void;
6116
6129
  isFinished(): boolean;
6117
- protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[]): number;
6130
+ protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[], loop?: boolean): number;
6118
6131
  protected _stopAllMotions(): void;
6119
6132
  createMotion(data: ArrayBuffer, group: string, definition: CubismSpec.Motion): CubismMotion;
6120
6133
  getMotionFile(definition: CubismSpec.Motion): string;
@@ -6133,7 +6146,7 @@ export declare class CubismParallelMotionManager extends ParallelMotionManager<C
6133
6146
  constructor(parent: CubismInternalModel);
6134
6147
  protected init(): void;
6135
6148
  isFinished(): boolean;
6136
- protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[]): number;
6149
+ protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[], loop?: boolean): number;
6137
6150
  protected _stopAllMotions(): void;
6138
6151
  protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean;
6139
6152
  protected getMotionName(definition: CubismSpec.Motion): string;