untitled-pixi-live2d-engine 1.3.0 → 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/dist/index.es.js CHANGED
@@ -105,7 +105,7 @@ const config = {
105
105
  preserveExpressionOnMotion: true,
106
106
  cubism: CubismFrameworkConfig
107
107
  };
108
- const VERSION = "1.3.0";
108
+ const VERSION = "1.3.1";
109
109
  const logger = {
110
110
  log(tag, ...messages) {
111
111
  if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
@@ -3357,13 +3357,18 @@ class Live2DModel extends Container {
3357
3357
  * group: The motion group,
3358
3358
  * index: Index in the motion group,
3359
3359
  * priority: The priority to be applied. (0: No priority, 1: IDLE, 2:NORMAL, 3:FORCE) (default: 2)
3360
+ * ignoreParamIds: The ids to be ignored,
3361
+ * loop: Whether the motion should loop.
3360
3362
  * @return Promise that resolves with a list, indicates the motion is successfully started, with false otherwise.
3361
3363
  */
3362
3364
  parallelMotion(motionList) {
3363
3365
  return __async(this, null, function* () {
3364
3366
  this.internalModel.extendParallelMotionManager(motionList.length);
3365
3367
  const result = motionList.map(
3366
- (m, idx) => this.internalModel.parallelMotionManager[idx].startMotion(m.group, m.index, m.priority)
3368
+ (m, idx) => this.internalModel.parallelMotionManager[idx].startMotion(m.group, m.index, m.priority, {
3369
+ ignoreParamIds: m.ignoreParamIds,
3370
+ loop: m.loop
3371
+ })
3367
3372
  );
3368
3373
  const flags = [];
3369
3374
  for (const r of result) {
@@ -3827,11 +3832,13 @@ class ParallelMotionManager extends EventEmitter {
3827
3832
  * @param index - Index in the motion group.
3828
3833
  * @param priority - The priority to be applied. default: 2 (NORMAL)
3829
3834
  * @param ignoreParamIds - The ids to be ignored.
3835
+ * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3830
3836
  * @return Promise that resolves with true if the motion is successfully started, with false otherwise.
3831
3837
  */
3832
3838
  startMotion(_0, _1) {
3833
- return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL, ignoreParamIds = []) {
3839
+ return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL, options = {}) {
3834
3840
  var _a;
3841
+ const { ignoreParamIds = [], loop } = Array.isArray(options) ? { ignoreParamIds: options, loop: void 0 } : options;
3835
3842
  if (!this.state.reserve(group, index, priority)) {
3836
3843
  return false;
3837
3844
  }
@@ -3846,7 +3853,7 @@ class ParallelMotionManager extends EventEmitter {
3846
3853
  logger.log(this.tag, "Start motion:", this.getMotionName(definition));
3847
3854
  this.emit("motionStart", group, index, void 0);
3848
3855
  this.playing = true;
3849
- this._startMotion(motion, void 0, ignoreParamIds);
3856
+ this._startMotion(motion, void 0, ignoreParamIds, loop);
3850
3857
  return true;
3851
3858
  });
3852
3859
  }
@@ -3854,10 +3861,11 @@ class ParallelMotionManager extends EventEmitter {
3854
3861
  * Starts a random Motion as given priority.
3855
3862
  * @param group - The motion group.
3856
3863
  * @param priority - The priority to be applied. (default: 1 `IDLE`)
3864
+ * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3857
3865
  * @return Promise that resolves with true if the motion is successfully started, with false otherwise.
3858
3866
  */
3859
- startRandomMotion(group, priority) {
3860
- return __async(this, null, function* () {
3867
+ startRandomMotion(_0, _1) {
3868
+ return __async(this, arguments, function* (group, priority, { loop = void 0 } = {}) {
3861
3869
  var _a;
3862
3870
  const groupDefs = this.manager.definitions[group];
3863
3871
  if (groupDefs == null ? void 0 : groupDefs.length) {
@@ -3870,7 +3878,7 @@ class ParallelMotionManager extends EventEmitter {
3870
3878
  }
3871
3879
  if (availableIndices.length) {
3872
3880
  const index = availableIndices[Math.floor(Math.random() * availableIndices.length)];
3873
- return this.startMotion(group, index, priority);
3881
+ return this.startMotion(group, index, priority, { loop });
3874
3882
  }
3875
3883
  }
3876
3884
  return false;
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ var __async = (__this, __arguments, generator) => {
108
108
  preserveExpressionOnMotion: true,
109
109
  cubism: CubismFrameworkConfig
110
110
  };
111
- const VERSION = "1.3.0";
111
+ const VERSION = "1.3.1";
112
112
  const logger = {
113
113
  log(tag, ...messages) {
114
114
  if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
@@ -3360,13 +3360,18 @@ var __async = (__this, __arguments, generator) => {
3360
3360
  * group: The motion group,
3361
3361
  * index: Index in the motion group,
3362
3362
  * priority: The priority to be applied. (0: No priority, 1: IDLE, 2:NORMAL, 3:FORCE) (default: 2)
3363
+ * ignoreParamIds: The ids to be ignored,
3364
+ * loop: Whether the motion should loop.
3363
3365
  * @return Promise that resolves with a list, indicates the motion is successfully started, with false otherwise.
3364
3366
  */
3365
3367
  parallelMotion(motionList) {
3366
3368
  return __async(this, null, function* () {
3367
3369
  this.internalModel.extendParallelMotionManager(motionList.length);
3368
3370
  const result = motionList.map(
3369
- (m, idx) => this.internalModel.parallelMotionManager[idx].startMotion(m.group, m.index, m.priority)
3371
+ (m, idx) => this.internalModel.parallelMotionManager[idx].startMotion(m.group, m.index, m.priority, {
3372
+ ignoreParamIds: m.ignoreParamIds,
3373
+ loop: m.loop
3374
+ })
3370
3375
  );
3371
3376
  const flags = [];
3372
3377
  for (const r of result) {
@@ -3830,11 +3835,13 @@ var __async = (__this, __arguments, generator) => {
3830
3835
  * @param index - Index in the motion group.
3831
3836
  * @param priority - The priority to be applied. default: 2 (NORMAL)
3832
3837
  * @param ignoreParamIds - The ids to be ignored.
3838
+ * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3833
3839
  * @return Promise that resolves with true if the motion is successfully started, with false otherwise.
3834
3840
  */
3835
3841
  startMotion(_0, _1) {
3836
- return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL, ignoreParamIds = []) {
3842
+ return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL, options = {}) {
3837
3843
  var _a;
3844
+ const { ignoreParamIds = [], loop } = Array.isArray(options) ? { ignoreParamIds: options, loop: void 0 } : options;
3838
3845
  if (!this.state.reserve(group, index, priority)) {
3839
3846
  return false;
3840
3847
  }
@@ -3849,7 +3856,7 @@ var __async = (__this, __arguments, generator) => {
3849
3856
  logger.log(this.tag, "Start motion:", this.getMotionName(definition));
3850
3857
  this.emit("motionStart", group, index, void 0);
3851
3858
  this.playing = true;
3852
- this._startMotion(motion, void 0, ignoreParamIds);
3859
+ this._startMotion(motion, void 0, ignoreParamIds, loop);
3853
3860
  return true;
3854
3861
  });
3855
3862
  }
@@ -3857,10 +3864,11 @@ var __async = (__this, __arguments, generator) => {
3857
3864
  * Starts a random Motion as given priority.
3858
3865
  * @param group - The motion group.
3859
3866
  * @param priority - The priority to be applied. (default: 1 `IDLE`)
3867
+ * @param loop - Whether the motion should loop. Overrides Cubism 3/4/5 motion JSON loop metadata when specified.
3860
3868
  * @return Promise that resolves with true if the motion is successfully started, with false otherwise.
3861
3869
  */
3862
- startRandomMotion(group, priority) {
3863
- return __async(this, null, function* () {
3870
+ startRandomMotion(_0, _1) {
3871
+ return __async(this, arguments, function* (group, priority, { loop = void 0 } = {}) {
3864
3872
  var _a;
3865
3873
  const groupDefs = this.manager.definitions[group];
3866
3874
  if (groupDefs == null ? void 0 : groupDefs.length) {
@@ -3873,7 +3881,7 @@ var __async = (__this, __arguments, generator) => {
3873
3881
  }
3874
3882
  if (availableIndices.length) {
3875
3883
  const index = availableIndices[Math.floor(Math.random() * availableIndices.length)];
3876
- return this.startMotion(group, index, priority);
3884
+ return this.startMotion(group, index, priority, { loop });
3877
3885
  }
3878
3886
  }
3879
3887
  return false;