@rive-app/webgl2 2.14.0 → 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.14.0",
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
@@ -3609,7 +3609,7 @@ be();
3609
3609
  /* 2 */
3610
3610
  /***/ ((module) => {
3611
3611
 
3612
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.14.0","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;