@doki-land/live2d 0.0.17 → 0.0.18

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.js CHANGED
@@ -27,36 +27,6 @@ import {
27
27
  createRenderer as createRenderer2
28
28
  } from "@doki-land/live2d-renderer";
29
29
 
30
- // src/stage/assets/focus.ts
31
- function focusParameterUpdates(parameters, dragX, dragY) {
32
- const byId = new Map(parameters.map((p) => [p.id, p]));
33
- const x = clampUnit(dragX);
34
- const y = clampUnit(dragY);
35
- const out = [];
36
- const set = (id, normalized) => {
37
- const binding = byId.get(id);
38
- if (!binding) return;
39
- out.push({ id, value: valueFromNormalized(binding, normalized) });
40
- };
41
- set("PARAM_ANGLE_X", x);
42
- set("PARAM_ANGLE_Y", y);
43
- set("PARAM_ANGLE_Z", clampUnit(x * y * -1));
44
- set("PARAM_BODY_ANGLE_X", x);
45
- set("PARAM_BODY_ANGLE_Y", y);
46
- set("PARAM_EYE_BALL_X", x);
47
- set("PARAM_EYE_BALL_Y", y);
48
- return out;
49
- }
50
- function clampUnit(n) {
51
- if (n > 1) return 1;
52
- if (n < -1) return -1;
53
- return n;
54
- }
55
- function valueFromNormalized(binding, normalized) {
56
- const n = clampUnit(normalized);
57
- return n >= 0 ? binding.defaultValue + (binding.max - binding.defaultValue) * n : binding.defaultValue + (binding.defaultValue - binding.min) * n;
58
- }
59
-
60
30
  // src/motion/evaluate-curve.ts
61
31
  function evaluateMotion3(clip, timeSeconds) {
62
32
  const t = clamp(timeSeconds, 0, clip.duration);
@@ -762,6 +732,36 @@ var ActorModelSlot = class {
762
732
  }
763
733
  };
764
734
 
735
+ // src/stage/assets/focus.ts
736
+ function focusParameterUpdates(parameters, dragX, dragY) {
737
+ const byId = new Map(parameters.map((p) => [p.id, p]));
738
+ const x = clampUnit(dragX);
739
+ const y = clampUnit(dragY);
740
+ const out = [];
741
+ const set = (id, normalized) => {
742
+ const binding = byId.get(id);
743
+ if (!binding) return;
744
+ out.push({ id, value: valueFromNormalized(binding, normalized) });
745
+ };
746
+ set("PARAM_ANGLE_X", x);
747
+ set("PARAM_ANGLE_Y", y);
748
+ set("PARAM_ANGLE_Z", clampUnit(x * y * -1));
749
+ set("PARAM_BODY_ANGLE_X", x);
750
+ set("PARAM_BODY_ANGLE_Y", y);
751
+ set("PARAM_EYE_BALL_X", x);
752
+ set("PARAM_EYE_BALL_Y", y);
753
+ return out;
754
+ }
755
+ function clampUnit(n) {
756
+ if (n > 1) return 1;
757
+ if (n < -1) return -1;
758
+ return n;
759
+ }
760
+ function valueFromNormalized(binding, normalized) {
761
+ const n = clampUnit(normalized);
762
+ return n >= 0 ? binding.defaultValue + (binding.max - binding.defaultValue) * n : binding.defaultValue + (binding.defaultValue - binding.min) * n;
763
+ }
764
+
765
765
  // src/stage/transform.ts
766
766
  import { DEFAULT_ACTOR_TRANSFORM } from "@doki-land/live2d-core";
767
767
  function resolveActorTransform(patch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doki-land/live2d",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Live2D in the browser — load moc2/moc3 models, Stage + multi-actor, motion; WebGPU/WebGL2/Canvas2D. Main entry for live2d.ts.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -59,9 +59,9 @@
59
59
  "test": "vitest run --passWithNoTests"
60
60
  },
61
61
  "dependencies": {
62
- "@doki-land/live2d-core": "0.0.17",
63
- "@doki-land/live2d-loader": "0.0.17",
64
- "@doki-land/live2d-renderer": "0.0.17"
62
+ "@doki-land/live2d-core": "0.0.18",
63
+ "@doki-land/live2d-loader": "0.0.18",
64
+ "@doki-land/live2d-renderer": "0.0.18"
65
65
  },
66
66
  "sideEffects": false
67
67
  }
package/src/index.ts CHANGED
@@ -73,7 +73,6 @@ export {
73
73
  MotionPriority,
74
74
  type PlayMotionOptions,
75
75
  } from "./facade/create-live2d.js";
76
- export { focusParameterUpdates } from "./stage/assets/focus.js";
77
76
  export {
78
77
  blendMotionLayers,
79
78
  evaluateCurve,
@@ -83,6 +82,7 @@ export {
83
82
  MotionPlayer,
84
83
  parseMotion3,
85
84
  } from "./motion/index.js";
85
+ export { focusParameterUpdates } from "./stage/assets/focus.js";
86
86
  export {
87
87
  type CreateLive2dStageFullOptions,
88
88
  createLive2dStage,
@@ -8,9 +8,9 @@ import type {
8
8
  PlayMotionActorOptions,
9
9
  } from "@doki-land/live2d-core";
10
10
  import type { DrawableMesh, Renderer } from "@doki-land/live2d-renderer";
11
- import { focusParameterUpdates } from "./assets/focus.js";
12
11
  import type { PlayMotionOptions } from "../motion/index.js";
13
12
  import { ActorModelSlot } from "./actor-model-slot.js";
13
+ import { focusParameterUpdates } from "./assets/focus.js";
14
14
  import type { ModelAssetRegistry } from "./model-asset-registry.js";
15
15
  import {
16
16
  resolveActorTransform,
@@ -23,8 +23,8 @@ import {
23
23
  compileSharedModelCompile,
24
24
  selectModelBackend,
25
25
  } from "@doki-land/live2d-renderer";
26
- import { loadTextureData, releaseTextureData } from "./assets/load-textures.js";
27
26
  import type { Motion3Clip } from "../motion/index.js";
27
+ import { loadTextureData, releaseTextureData } from "./assets/load-textures.js";
28
28
  import { resolveModelAssetKey } from "./model-asset-key.js";
29
29
 
30
30
  function lerp(a: number, b: number, t: number): number {