untitled-pixi-live2d-engine 1.2.2 → 1.3.1
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/README.md +13 -2
- package/dist/cubism-legacy.es.js +170 -49
- package/dist/cubism-legacy.js +172 -50
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +186 -57
- package/dist/cubism.js +188 -58
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +191 -60
- package/dist/index.js +193 -61
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +56 -29
package/package.json
CHANGED
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 {
|
|
@@ -744,6 +744,14 @@ export declare class FocusController {
|
|
|
744
744
|
*/
|
|
745
745
|
update(dt: DOMHighResTimeStamp): void;
|
|
746
746
|
}
|
|
747
|
+
export interface ParallelMotionStartOptions {
|
|
748
|
+
ignoreParamIds?: string[];
|
|
749
|
+
/**
|
|
750
|
+
* Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
751
|
+
*/
|
|
752
|
+
loop?: boolean;
|
|
753
|
+
}
|
|
754
|
+
export type ParallelMotionStartRandomOptions = Omit<ParallelMotionStartOptions, "ignoreParamIds">;
|
|
747
755
|
declare abstract class ParallelMotionManager<Motion = never, MotionSpec = never> extends EventEmitter {
|
|
748
756
|
/**
|
|
749
757
|
* Tag for logging.
|
|
@@ -774,16 +782,18 @@ declare abstract class ParallelMotionManager<Motion = never, MotionSpec = never>
|
|
|
774
782
|
* @param index - Index in the motion group.
|
|
775
783
|
* @param priority - The priority to be applied. default: 2 (NORMAL)
|
|
776
784
|
* @param ignoreParamIds - The ids to be ignored.
|
|
785
|
+
* @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
777
786
|
* @return Promise that resolves with true if the motion is successfully started, with false otherwise.
|
|
778
787
|
*/
|
|
779
|
-
startMotion(group: string, index: number, priority?: MotionPriority,
|
|
788
|
+
startMotion(group: string, index: number, priority?: MotionPriority, options?: ParallelMotionStartOptions | string[]): Promise<boolean>;
|
|
780
789
|
/**
|
|
781
790
|
* Starts a random Motion as given priority.
|
|
782
791
|
* @param group - The motion group.
|
|
783
792
|
* @param priority - The priority to be applied. (default: 1 `IDLE`)
|
|
793
|
+
* @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
784
794
|
* @return Promise that resolves with true if the motion is successfully started, with false otherwise.
|
|
785
795
|
*/
|
|
786
|
-
startRandomMotion(group: string, priority?: MotionPriority): Promise<boolean>;
|
|
796
|
+
startRandomMotion(group: string, priority?: MotionPriority, { loop }?: ParallelMotionStartRandomOptions): Promise<boolean>;
|
|
787
797
|
/**
|
|
788
798
|
* Stops all playing motions as well as the sound.
|
|
789
799
|
*/
|
|
@@ -812,7 +822,7 @@ declare abstract class ParallelMotionManager<Motion = never, MotionSpec = never>
|
|
|
812
822
|
/**
|
|
813
823
|
* Starts the Motion.
|
|
814
824
|
*/
|
|
815
|
-
protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void, ignoreParamIds?: string[]): number;
|
|
825
|
+
protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void, ignoreParamIds?: string[], loop?: boolean): number;
|
|
816
826
|
/**
|
|
817
827
|
* Stops all playing motions.
|
|
818
828
|
*/
|
|
@@ -3116,6 +3126,11 @@ export interface InternalModelOptions extends MotionManagerOptions {
|
|
|
3116
3126
|
* @default 0.4
|
|
3117
3127
|
*/
|
|
3118
3128
|
lipSyncWeight?: number;
|
|
3129
|
+
/**
|
|
3130
|
+
* Whether to enable automatic eye blinking between motions.
|
|
3131
|
+
* @default true
|
|
3132
|
+
*/
|
|
3133
|
+
eyeBlink?: boolean;
|
|
3119
3134
|
/**
|
|
3120
3135
|
* Whether to use Cubism's high precision clipping mask rendering.
|
|
3121
3136
|
* Only supported by Cubism 3/4/5 models.
|
|
@@ -3325,6 +3340,20 @@ export interface MotionManagerOptions {
|
|
|
3325
3340
|
*/
|
|
3326
3341
|
checkMotionConsistency?: boolean;
|
|
3327
3342
|
}
|
|
3343
|
+
export interface MotionStartOptions {
|
|
3344
|
+
sound?: string;
|
|
3345
|
+
volume?: number;
|
|
3346
|
+
expression?: number | string;
|
|
3347
|
+
resetExpression?: boolean;
|
|
3348
|
+
onFinish?: () => void;
|
|
3349
|
+
onError?: (e: Error) => void;
|
|
3350
|
+
ignoreParamIds?: string[];
|
|
3351
|
+
/**
|
|
3352
|
+
* Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
3353
|
+
*/
|
|
3354
|
+
loop?: boolean;
|
|
3355
|
+
}
|
|
3356
|
+
export type MotionStartRandomOptions = Omit<MotionStartOptions, "ignoreParamIds">;
|
|
3328
3357
|
/**
|
|
3329
3358
|
* Indicates how the motions will be preloaded.
|
|
3330
3359
|
*/
|
|
@@ -3490,17 +3519,10 @@ export declare abstract class MotionManager<Motion = unknown, MotionSpec = unkno
|
|
|
3490
3519
|
* @param onFinish - Callback when playback finishes.
|
|
3491
3520
|
* @param onError - Callback when playback errors.
|
|
3492
3521
|
* @param ignoreParamIds - The ids to be ignored.
|
|
3522
|
+
* @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
3493
3523
|
* @return Promise that resolves with true if the motion is successfully started, false otherwise.
|
|
3494
3524
|
*/
|
|
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>;
|
|
3525
|
+
startMotion(group: string, index: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, ignoreParamIds, loop }?: MotionStartOptions): Promise<boolean>;
|
|
3504
3526
|
/**
|
|
3505
3527
|
* Starts a random Motion as given priority.
|
|
3506
3528
|
* @param group - The motion group.
|
|
@@ -3512,16 +3534,10 @@ export declare abstract class MotionManager<Motion = unknown, MotionSpec = unkno
|
|
|
3512
3534
|
* @param crossOrigin - Cross origin setting.
|
|
3513
3535
|
* @param onFinish - Callback when playback finishes.
|
|
3514
3536
|
* @param onError - Callback when playback errors.
|
|
3537
|
+
* @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
3515
3538
|
* @return Promise that resolves with true if the motion is successfully started, false otherwise.
|
|
3516
3539
|
*/
|
|
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>;
|
|
3540
|
+
startRandomMotion(group: string, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, loop }?: MotionStartRandomOptions): Promise<boolean>;
|
|
3525
3541
|
/**
|
|
3526
3542
|
* Stops current audio playback and lipsync.
|
|
3527
3543
|
*/
|
|
@@ -3589,11 +3605,12 @@ export declare abstract class MotionManager<Motion = unknown, MotionSpec = unkno
|
|
|
3589
3605
|
* @param motion - The Motion to start.
|
|
3590
3606
|
* @param onFinish - Optional callback when finished.
|
|
3591
3607
|
* @param ignoreParamIds - The ids to be ignored.
|
|
3608
|
+
* @param loop - Whether the motion should loop.
|
|
3592
3609
|
* @returns An ID or token for the motion.
|
|
3593
3610
|
* @protected
|
|
3594
3611
|
* @abstract
|
|
3595
3612
|
*/
|
|
3596
|
-
protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void, ignoreParamIds?: string[]): number;
|
|
3613
|
+
protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void, ignoreParamIds?: string[], loop?: boolean): number;
|
|
3597
3614
|
/**
|
|
3598
3615
|
* Stops all playing motions.
|
|
3599
3616
|
* @protected
|
|
@@ -3899,6 +3916,10 @@ export declare class SoundManager {
|
|
|
3899
3916
|
static audios: Sound[];
|
|
3900
3917
|
static analysers: AnalyserNode[];
|
|
3901
3918
|
static contexts: AudioContext[];
|
|
3919
|
+
protected static aliases: WeakMap<Sound, {
|
|
3920
|
+
alias: string;
|
|
3921
|
+
library: SoundLibrary;
|
|
3922
|
+
}>;
|
|
3902
3923
|
protected static _volume: number;
|
|
3903
3924
|
/**
|
|
3904
3925
|
* Global volume that applies to all the sounds.
|
|
@@ -3918,13 +3939,13 @@ export declare class SoundManager {
|
|
|
3918
3939
|
* @param onFinish - Callback invoked when the playback has finished.
|
|
3919
3940
|
*/
|
|
3920
3941
|
static play(audio: Sound, onFinish?: () => void): void;
|
|
3921
|
-
static addAnalyzer(audio: Sound, context: AudioContext): AnalyserNode;
|
|
3942
|
+
static addAnalyzer(audio: Sound, context: AudioContext): AnalyserNode | undefined;
|
|
3922
3943
|
/**
|
|
3923
3944
|
* Get volume for lip sync
|
|
3924
3945
|
* @param analyser - An analyzer element.
|
|
3925
3946
|
* @return Returns value to feed into lip sync
|
|
3926
3947
|
*/
|
|
3927
|
-
static analyze(analyser
|
|
3948
|
+
static analyze(analyser?: AnalyserNode): number;
|
|
3928
3949
|
/**
|
|
3929
3950
|
* Disposes an audio element and removes it from {@link audios}.
|
|
3930
3951
|
* @param audio - An audio element.
|
|
@@ -4448,15 +4469,17 @@ export declare class Live2DModel<IM extends InternalModel = InternalModel> exten
|
|
|
4448
4469
|
* @param [options.resetExpression=true] - Reset the expression to default after the motion is finished.
|
|
4449
4470
|
* @param [options.onFinish] - Callback function when speaking completes.
|
|
4450
4471
|
* @param [options.onError] - Callback function when an error occurs.
|
|
4472
|
+
* @param [options.loop] - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
|
|
4451
4473
|
* @return Promise that resolves with true if the motion is successfully started, with false otherwise.
|
|
4452
4474
|
*/
|
|
4453
|
-
motion(group: string, index?: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError }?: {
|
|
4475
|
+
motion(group: string, index?: number, priority?: MotionPriority, { sound, volume, expression, resetExpression, onFinish, onError, loop }?: {
|
|
4454
4476
|
sound?: string;
|
|
4455
4477
|
volume?: number;
|
|
4456
4478
|
expression?: number | string;
|
|
4457
4479
|
resetExpression?: boolean;
|
|
4458
4480
|
onFinish?: () => void;
|
|
4459
4481
|
onError?: (e: Error) => void;
|
|
4482
|
+
loop?: boolean;
|
|
4460
4483
|
}): Promise<boolean>;
|
|
4461
4484
|
motionLastFrame(group: string, id: number, { expression }?: {
|
|
4462
4485
|
expression?: number | string;
|
|
@@ -4467,12 +4490,16 @@ export declare class Live2DModel<IM extends InternalModel = InternalModel> exten
|
|
|
4467
4490
|
* group: The motion group,
|
|
4468
4491
|
* index: Index in the motion group,
|
|
4469
4492
|
* priority: The priority to be applied. (0: No priority, 1: IDLE, 2:NORMAL, 3:FORCE) (default: 2)
|
|
4493
|
+
* ignoreParamIds: The ids to be ignored,
|
|
4494
|
+
* loop: Whether the motion should loop.
|
|
4470
4495
|
* @return Promise that resolves with a list, indicates the motion is successfully started, with false otherwise.
|
|
4471
4496
|
*/
|
|
4472
4497
|
parallelMotion(motionList: {
|
|
4473
4498
|
group: string;
|
|
4474
4499
|
index: number;
|
|
4475
4500
|
priority?: MotionPriority;
|
|
4501
|
+
ignoreParamIds?: string[];
|
|
4502
|
+
loop?: boolean;
|
|
4476
4503
|
}[]): Promise<boolean[]>;
|
|
4477
4504
|
/**
|
|
4478
4505
|
* Shorthand to play the last frame of multiple motions in parallel and await their completion.
|
|
@@ -4995,7 +5022,7 @@ export declare class CubismLegacyMotionManager extends MotionManager<Live2DMotio
|
|
|
4995
5022
|
getMotionFile(definition: Cubism2Spec.Motion): string;
|
|
4996
5023
|
protected getMotionName(definition: Cubism2Spec.Motion): string;
|
|
4997
5024
|
protected getSoundFile(definition: Cubism2Spec.Motion): string | undefined;
|
|
4998
|
-
protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[]): number;
|
|
5025
|
+
protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[], _loop?: boolean): number;
|
|
4999
5026
|
protected _stopAllMotions(): void;
|
|
5000
5027
|
protected updateParameters(model: Live2DModelWebGL, _now: DOMHighResTimeStamp): boolean;
|
|
5001
5028
|
destroy(): void;
|
|
@@ -5008,7 +5035,7 @@ export declare class CubismLegacyParallelMotionManager extends ParallelMotionMan
|
|
|
5008
5035
|
constructor(parent: CubismLegacyInternalModel);
|
|
5009
5036
|
isFinished(): boolean;
|
|
5010
5037
|
protected getMotionName(definition: Cubism2Spec.Motion): string;
|
|
5011
|
-
protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[]): number;
|
|
5038
|
+
protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void, ignoreParamIds?: string[], _loop?: boolean): number;
|
|
5012
5039
|
protected _stopAllMotions(): void;
|
|
5013
5040
|
protected updateParameters(model: Live2DModelWebGL, _now: DOMHighResTimeStamp): boolean;
|
|
5014
5041
|
destroy(): void;
|
|
@@ -6114,7 +6141,7 @@ export declare class CubismMotionManager extends MotionManager<CubismMotion, Cub
|
|
|
6114
6141
|
constructor(parent: CubismInternalModel);
|
|
6115
6142
|
protected init(options?: MotionManagerOptions): void;
|
|
6116
6143
|
isFinished(): boolean;
|
|
6117
|
-
protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[]): number;
|
|
6144
|
+
protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[], loop?: boolean): number;
|
|
6118
6145
|
protected _stopAllMotions(): void;
|
|
6119
6146
|
createMotion(data: ArrayBuffer, group: string, definition: CubismSpec.Motion): CubismMotion;
|
|
6120
6147
|
getMotionFile(definition: CubismSpec.Motion): string;
|
|
@@ -6133,7 +6160,7 @@ export declare class CubismParallelMotionManager extends ParallelMotionManager<C
|
|
|
6133
6160
|
constructor(parent: CubismInternalModel);
|
|
6134
6161
|
protected init(): void;
|
|
6135
6162
|
isFinished(): boolean;
|
|
6136
|
-
protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[]): number;
|
|
6163
|
+
protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void, ignoreParamIds?: string[], loop?: boolean): number;
|
|
6137
6164
|
protected _stopAllMotions(): void;
|
|
6138
6165
|
protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean;
|
|
6139
6166
|
protected getMotionName(definition: CubismSpec.Motion): string;
|