ruiyun-human 1.0.3 → 1.0.5

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.
@@ -449,19 +449,27 @@ const _sfc_main = {
449
449
  const width = image.width * scale;
450
450
  const height = image.height * scale;
451
451
  const x = (canvas.width - width) / 2;
452
- const y = (canvas.height - height) / 2;
452
+ const y = canvas.height - height;
453
453
  ctx.value.drawImage(image, x, y, width, height);
454
454
  };
455
- const stop = () => {
455
+ const stop = (keepAudio = false) => {
456
+ var _a;
456
457
  if (animationId.value) {
457
458
  cancelAnimationFrame(animationId.value);
458
459
  animationId.value = null;
459
460
  }
461
+ if (!keepAudio) {
462
+ try {
463
+ (_a = currentAudio.value) == null ? void 0 : _a.pause();
464
+ } catch (error) {
465
+ }
466
+ }
460
467
  frameIndex.value = 1;
461
468
  animationState.value = "standby";
462
469
  };
463
470
  const runAnimation = (state) => {
464
- stop();
471
+ const keepAudio = state === "speak" || state === "speakLoop" || state === "speakEnd";
472
+ stop(keepAudio);
465
473
  animationState.value = state;
466
474
  loopDirection.value = 1;
467
475
  let currentFrames;
@@ -612,7 +620,6 @@ const _sfc_main = {
612
620
  canvas.style.width = width + "px";
613
621
  canvas.style.height = height + "px";
614
622
  ctx.value = canvas.getContext("2d");
615
- ctx.value.scale(dpr, dpr);
616
623
  loadFrames();
617
624
  waitFramesLoaded(() => {
618
625
  draw(frames.value.standby[0]);
@@ -882,7 +889,7 @@ const _sfc_main = {
882
889
  };
883
890
  }
884
891
  };
885
- const DigitalHuman = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-aae25c55"]]);
892
+ const DigitalHuman = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b3682025"]]);
886
893
  DigitalHuman.install = (app) => app.component("DigitalHuman", DigitalHuman);
887
894
  const components = [DemoButton, DemoInput, DigitalHuman];
888
895
  const install = (app) => {
@@ -447,19 +447,27 @@ const _sfc_main = {
447
447
  const width = image.width * scale;
448
448
  const height = image.height * scale;
449
449
  const x = (canvas.width - width) / 2;
450
- const y = (canvas.height - height) / 2;
450
+ const y = canvas.height - height;
451
451
  ctx.value.drawImage(image, x, y, width, height);
452
452
  };
453
- const stop = () => {
453
+ const stop = (keepAudio = false) => {
454
+ var _a;
454
455
  if (animationId.value) {
455
456
  cancelAnimationFrame(animationId.value);
456
457
  animationId.value = null;
457
458
  }
459
+ if (!keepAudio) {
460
+ try {
461
+ (_a = currentAudio.value) == null ? void 0 : _a.pause();
462
+ } catch (error) {
463
+ }
464
+ }
458
465
  frameIndex.value = 1;
459
466
  animationState.value = "standby";
460
467
  };
461
468
  const runAnimation = (state) => {
462
- stop();
469
+ const keepAudio = state === "speak" || state === "speakLoop" || state === "speakEnd";
470
+ stop(keepAudio);
463
471
  animationState.value = state;
464
472
  loopDirection.value = 1;
465
473
  let currentFrames;
@@ -610,7 +618,6 @@ const _sfc_main = {
610
618
  canvas.style.width = width + "px";
611
619
  canvas.style.height = height + "px";
612
620
  ctx.value = canvas.getContext("2d");
613
- ctx.value.scale(dpr, dpr);
614
621
  loadFrames();
615
622
  waitFramesLoaded(() => {
616
623
  draw(frames.value.standby[0]);
@@ -880,7 +887,7 @@ const _sfc_main = {
880
887
  };
881
888
  }
882
889
  };
883
- const DigitalHuman = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-aae25c55"]]);
890
+ const DigitalHuman = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b3682025"]]);
884
891
  DigitalHuman.install = (app) => app.component("DigitalHuman", DigitalHuman);
885
892
  const components = [DemoButton, DemoInput, DigitalHuman];
886
893
  const install = (app) => {
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .demo-btn[data-v-9a48516a]{padding:6px 14px;border-radius:4px;border:none;cursor:pointer;font-size:14px}.primary[data-v-9a48516a]{background:#409eff;color:#fff}.success[data-v-9a48516a]{background:#67c23a;color:#fff}.warning[data-v-9a48516a]{background:#e6a23c;color:#fff}.demo-input-wrap[data-v-28a3493c]{display:inline-flex;align-items:center;border:1px solid #dcdcdc;border-radius:4px;padding:0 10px}.demo-input-wrap[data-v-28a3493c]:focus-within{border-color:#409eff}.demo-input[data-v-28a3493c]{border:none;outline:none;padding:8px 6px;flex:1}.prefix[data-v-28a3493c],.suffix[data-v-28a3493c]{color:#909399}.digital-human[data-v-aae25c55]{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.digital-human canvas[data-v-aae25c55]{max-width:100%;max-height:100%}
1
+ .demo-btn[data-v-9a48516a]{padding:6px 14px;border-radius:4px;border:none;cursor:pointer;font-size:14px}.primary[data-v-9a48516a]{background:#409eff;color:#fff}.success[data-v-9a48516a]{background:#67c23a;color:#fff}.warning[data-v-9a48516a]{background:#e6a23c;color:#fff}.demo-input-wrap[data-v-28a3493c]{display:inline-flex;align-items:center;border:1px solid #dcdcdc;border-radius:4px;padding:0 10px}.demo-input-wrap[data-v-28a3493c]:focus-within{border-color:#409eff}.demo-input[data-v-28a3493c]{border:none;outline:none;padding:8px 6px;flex:1}.prefix[data-v-28a3493c],.suffix[data-v-28a3493c]{color:#909399}.digital-human[data-v-b3682025]{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.digital-human canvas[data-v-b3682025]{max-width:100%;max-height:100%}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "ruiyun-human",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "description": "数字人初步实现",
6
- "main": "./dist/ruiyun-human.umd.js",
6
+ "main": "./dist/ruiyun-human.cjs.js",
7
7
  "module": "./dist/ruiyun-human.es.js",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/ruiyun-human.es.js",
11
- "require": "./dist/ruiyun-human.umd.js"
11
+ "require": "./dist/ruiyun-human.cjs.js"
12
12
  }
13
13
  },
14
14
  "files": [
Binary file