@rive-app/webgl2 2.13.2 → 2.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl2",
3
- "version": "2.13.2",
3
+ "version": "2.14.1",
4
4
  "description": "Rive's webgl2 based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rc from "./rive_advanced.mjs";
2
- export type { FileAsset, FontAsset, ImageAsset } from './rive_advanced.mjs';
2
+ export type { FileAsset, FontAsset, ImageAsset } from "./rive_advanced.mjs";
3
3
  /**
4
4
  * Generic type for a parameterless void callback
5
5
  */
@@ -304,6 +304,7 @@ export declare class Rive {
304
304
  private shouldDisableRiveListeners;
305
305
  private automaticallyHandleEvents;
306
306
  private enableRiveAssetCDN;
307
+ private _volume;
307
308
  durations: number[];
308
309
  frameTimes: number[];
309
310
  frameCount: number;
@@ -525,6 +526,11 @@ export declare class Rive {
525
526
  * Returns the contents of a Rive file: the artboards, animations, and state machines
526
527
  */
527
528
  get contents(): RiveFileContents;
529
+ /**
530
+ * getter and setter for the volume of the artboard
531
+ */
532
+ get volume(): number;
533
+ set volume(value: number);
528
534
  }
529
535
  /**
530
536
  * Contents of a state machine input
package/rive.js CHANGED
@@ -410,7 +410,7 @@ function Pa(a, b) {
410
410
  return Oa(c, a, b);
411
411
  }));
412
412
  }
413
- var J, K, Ta = {473544:(a, b, c, d, e) => {
413
+ var J, K, Ta = {473560:(a, b, c, d, e) => {
414
414
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
415
415
  return 0;
416
416
  }
@@ -473,9 +473,9 @@ var J, K, Ta = {473544:(a, b, c, d, e) => {
473
473
  }
474
474
  window.h.Da += 1;
475
475
  return 1;
476
- }, 475722:() => {
476
+ }, 475738:() => {
477
477
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
478
- }, 475886:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 475990:() => {
478
+ }, 475902:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476006:() => {
479
479
  try {
480
480
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
481
481
  a.close();
@@ -483,7 +483,7 @@ var J, K, Ta = {473544:(a, b, c, d, e) => {
483
483
  } catch (c) {
484
484
  return 0;
485
485
  }
486
- }, 476161:(a, b, c, d, e, f) => {
486
+ }, 476177:(a, b, c, d, e, f) => {
487
487
  if ("undefined" === typeof window.h) {
488
488
  return -1;
489
489
  }
@@ -529,7 +529,7 @@ var J, K, Ta = {473544:(a, b, c, d, e) => {
529
529
  a == window.h.I.Ca && g.Z.connect(g.J.destination);
530
530
  g.kb = f;
531
531
  return window.h.tc(g);
532
- }, 479038:a => window.h.wa(a).J.sampleRate, 479111:a => {
532
+ }, 479054:a => window.h.wa(a).J.sampleRate, 479127:a => {
533
533
  a = window.h.wa(a);
534
534
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
535
535
  }, a.Z.disconnect(), a.Z = void 0);
@@ -537,13 +537,13 @@ var J, K, Ta = {473544:(a, b, c, d, e) => {
537
537
  a.J.close();
538
538
  a.J = void 0;
539
539
  a.kb = void 0;
540
- }, 479511:a => {
540
+ }, 479527:a => {
541
541
  window.h.xb(a);
542
- }, 479561:a => {
542
+ }, 479577:a => {
543
543
  a = window.h.wa(a);
544
544
  a.J.resume();
545
545
  a.state = window.h.ha.sb;
546
- }, 479700:a => {
546
+ }, 479716:a => {
547
547
  a = window.h.wa(a);
548
548
  a.J.suspend();
549
549
  a.state = window.h.ha.stopped;
@@ -3548,8 +3548,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = y.dynCall_viijii
3548
3548
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = y.dynCall_iiiiij)(a, b, c, d, e, f, g);
3549
3549
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = y.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3550
3550
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = y.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3551
- n.___start_em_js = 470920;
3552
- n.___stop_em_js = 473544;
3551
+ n.___start_em_js = 470936;
3552
+ n.___stop_em_js = 473560;
3553
3553
  var $d;
3554
3554
  Ia = function ae() {
3555
3555
  $d || be();
@@ -3609,7 +3609,7 @@ be();
3609
3609
  /* 2 */
3610
3610
  /***/ ((module) => {
3611
3611
 
3612
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.13.2","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3612
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.14.1","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3613
3613
 
3614
3614
  /***/ }),
3615
3615
  /* 3 */
@@ -4869,6 +4869,8 @@ var Rive = /** @class */ (function () {
4869
4869
  this.automaticallyHandleEvents = false;
4870
4870
  // Allow the runtime to automatically load assets hosted in Rive's runtime.
4871
4871
  this.enableRiveAssetCDN = true;
4872
+ // Keep a local value of the set volume to update it asynchronously
4873
+ this._volume = 1;
4872
4874
  // Durations to generate a frame for the last second. Used for performance profiling.
4873
4875
  this.durations = [];
4874
4876
  this.frameTimes = [];
@@ -4999,7 +5001,8 @@ var Rive = /** @class */ (function () {
4999
5001
  .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
5000
5002
  .map(function (sm) { return sm.instance; });
5001
5003
  var touchScrollEnabledOption = this.isTouchScrollEnabled;
5002
- if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
5004
+ if (riveListenerOptions &&
5005
+ "isTouchScrollEnabled" in riveListenerOptions) {
5003
5006
  touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
5004
5007
  }
5005
5008
  this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
@@ -5089,6 +5092,7 @@ var Rive = /** @class */ (function () {
5089
5092
  return;
5090
5093
  }
5091
5094
  this.artboard = rootArtboard;
5095
+ rootArtboard.volume = this._volume;
5092
5096
  // Check that the artboard has at least 1 animation
5093
5097
  if (this.artboard.animationCount() < 1) {
5094
5098
  var msg = "Artboard has no animations";
@@ -5816,6 +5820,25 @@ var Rive = /** @class */ (function () {
5816
5820
  enumerable: false,
5817
5821
  configurable: true
5818
5822
  });
5823
+ Object.defineProperty(Rive.prototype, "volume", {
5824
+ /**
5825
+ * getter and setter for the volume of the artboard
5826
+ */
5827
+ get: function () {
5828
+ if (this.artboard && this.artboard.volume !== this._volume) {
5829
+ this._volume = this.artboard.volume;
5830
+ }
5831
+ return this._volume;
5832
+ },
5833
+ set: function (value) {
5834
+ this._volume = value;
5835
+ if (this.artboard) {
5836
+ this.artboard.volume = value;
5837
+ }
5838
+ },
5839
+ enumerable: false,
5840
+ configurable: true
5841
+ });
5819
5842
  // Error message for missing source or buffer
5820
5843
  Rive.missingErrorMessage = "Rive source file or data buffer required";
5821
5844
  return Rive;