@charivo/render-live2d 0.1.5 → 0.2.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/README.md CHANGED
@@ -39,9 +39,10 @@ The renderer exposes:
39
39
  - `getAvailableMotionGroups()`
40
40
  - `playExpression(expressionId)`
41
41
  - `playMotionByGroup(group, index)`
42
+ - `lookAt({ x, y })`
42
43
 
43
44
  When used through `@charivo/render-core`, realtime lip sync, mouse tracking,
44
- and emotion-driven motion selection are handled for you.
45
+ and gaze are handled for you.
45
46
 
46
47
  ## License Note
47
48
 
package/dist/renderer.js CHANGED
@@ -14399,6 +14399,10 @@ var Live2DRenderer = class _Live2DRenderer {
14399
14399
  this.model.startMotion(group, index, PriorityNormal);
14400
14400
  }
14401
14401
  }
14402
+ lookAt(coords) {
14403
+ if (!this.model?.isReady()) return;
14404
+ this.model.setDragging(clamp(coords.x, -1, 1), clamp(coords.y, -1, 1));
14405
+ }
14402
14406
  async destroy() {
14403
14407
  if (this.animationFrameId) {
14404
14408
  cancelAnimationFrame(this.animationFrameId);
@@ -14531,6 +14535,9 @@ var Live2DRenderer = class _Live2DRenderer {
14531
14535
  function createLive2DRenderer(options) {
14532
14536
  return new Live2DRenderer(options);
14533
14537
  }
14538
+ function clamp(value, min, max) {
14539
+ return Math.max(min, Math.min(max, value));
14540
+ }
14534
14541
 
14535
14542
  export { Live2DRenderer, createLive2DRenderer };
14536
14543
  //# sourceMappingURL=renderer.js.map