@alxxsck/ai-assistant 1.7.0 → 1.8.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.
@@ -29337,6 +29337,8 @@ class iS extends EventTarget {
29337
29337
  };
29338
29338
  controls;
29339
29339
  locale;
29340
+ animationFrame = null;
29341
+ renderingEnabled = !0;
29340
29342
  lightAmbient;
29341
29343
  lightDirectional;
29342
29344
  loadingManager;
@@ -29526,10 +29528,19 @@ class iS extends EventTarget {
29526
29528
  !e || !t || e == this.width && t == this.height || (this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.renderer.setSize(e, t, !1), this.render(), this.width = e, this.height = t);
29527
29529
  };
29528
29530
  animate = () => {
29529
- requestAnimationFrame(this.animate);
29531
+ if (this.animationFrame = null, !this.renderingEnabled) return;
29530
29532
  const e = this.clock.getDelta(), t = this.sound?.seek();
29531
- this.animationManager.update(e, t), this.controls?.update(), this.render();
29533
+ this.animationManager.update(e, t), this.controls?.update(), this.render(), this.animationFrame = requestAnimationFrame(this.animate);
29532
29534
  };
29535
+ setRenderingEnabled(e) {
29536
+ if (this.renderingEnabled !== e) {
29537
+ if (this.renderingEnabled = e, !e) {
29538
+ this.animationFrame !== null && (cancelAnimationFrame(this.animationFrame), this.animationFrame = null), this.clock.stop();
29539
+ return;
29540
+ }
29541
+ this.clock.start(), this.animationFrame === null && this.animationManager && (this.animationFrame = requestAnimationFrame(this.animate));
29542
+ }
29543
+ }
29533
29544
  SPEAKING_ANIMATION_NAME_1 = "generic_speaking_1";
29534
29545
  SPEAKING_ANIMATION_NAME_2 = "generic_speaking_2";
29535
29546
  IDLE_ANIMATION_NAME_1 = "idle_1";
@@ -29593,7 +29604,7 @@ class iS extends EventTarget {
29593
29604
  this.api.onAvatarReady(this.externalLaunchAnimationAction);
29594
29605
  };
29595
29606
  async initDebugControls(e) {
29596
- const { OrbitControls: t } = await import("./OrbitControls-BCIW0o5s.js");
29607
+ const { OrbitControls: t } = await import("./OrbitControls-BhEr8WlG.js");
29597
29608
  this.controls = new t(e, this.renderer.domElement);
29598
29609
  }
29599
29610
  async addDebugGui() {
@@ -1,4 +1,4 @@
1
- import { C as S, V as p, M as u, T as _, Q as E, S as P, a as c, R as w, P as O, b as R } from "./Avatar-_GvrPzkn.js";
1
+ import { C as S, V as p, M as u, T as _, Q as E, S as P, a as c, R as w, P as O, b as R } from "./Avatar-BAlmduYw.js";
2
2
  const D = { type: "change" }, b = { type: "start" }, M = { type: "end" }, f = new w(), T = new O(), j = Math.cos(70 * R.DEG2RAD), n = new p(), r = 2 * Math.PI, o = {
3
3
  NONE: -1,
4
4
  ROTATE: 0,
@@ -34,6 +34,8 @@ export declare class Avatar extends EventTarget {
34
34
  private cameraParams;
35
35
  private controls?;
36
36
  private locale?;
37
+ private animationFrame;
38
+ private renderingEnabled;
37
39
  constructor(canvas: HTMLCanvasElement, videoContainer: HTMLDivElement, config: WidgetConfig, api: AppApi);
38
40
  private lightAmbient;
39
41
  private lightDirectional;
@@ -47,6 +49,7 @@ export declare class Avatar extends EventTarget {
47
49
  private height;
48
50
  onResize: (width?: number, height?: number) => void;
49
51
  animate: () => void;
52
+ setRenderingEnabled(enabled: boolean): void;
50
53
  private SPEAKING_ANIMATION_NAME_1;
51
54
  private SPEAKING_ANIMATION_NAME_2;
52
55
  private IDLE_ANIMATION_NAME_1;