@rive-app/canvas 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/canvas",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "Rive's canvas 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
@@ -3404,7 +3404,7 @@ Zd();
3404
3404
  /* 2 */
3405
3405
  /***/ ((module) => {
3406
3406
 
3407
- module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.14.0","description":"Rive\'s canvas 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)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3407
+ module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.14.1","description":"Rive\'s canvas 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)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3408
3408
 
3409
3409
  /***/ }),
3410
3410
  /* 3 */
@@ -4664,6 +4664,8 @@ var Rive = /** @class */ (function () {
4664
4664
  this.automaticallyHandleEvents = false;
4665
4665
  // Allow the runtime to automatically load assets hosted in Rive's runtime.
4666
4666
  this.enableRiveAssetCDN = true;
4667
+ // Keep a local value of the set volume to update it asynchronously
4668
+ this._volume = 1;
4667
4669
  // Durations to generate a frame for the last second. Used for performance profiling.
4668
4670
  this.durations = [];
4669
4671
  this.frameTimes = [];
@@ -4794,7 +4796,8 @@ var Rive = /** @class */ (function () {
4794
4796
  .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
4795
4797
  .map(function (sm) { return sm.instance; });
4796
4798
  var touchScrollEnabledOption = this.isTouchScrollEnabled;
4797
- if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
4799
+ if (riveListenerOptions &&
4800
+ "isTouchScrollEnabled" in riveListenerOptions) {
4798
4801
  touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
4799
4802
  }
4800
4803
  this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
@@ -4884,6 +4887,7 @@ var Rive = /** @class */ (function () {
4884
4887
  return;
4885
4888
  }
4886
4889
  this.artboard = rootArtboard;
4890
+ rootArtboard.volume = this._volume;
4887
4891
  // Check that the artboard has at least 1 animation
4888
4892
  if (this.artboard.animationCount() < 1) {
4889
4893
  var msg = "Artboard has no animations";
@@ -5611,6 +5615,25 @@ var Rive = /** @class */ (function () {
5611
5615
  enumerable: false,
5612
5616
  configurable: true
5613
5617
  });
5618
+ Object.defineProperty(Rive.prototype, "volume", {
5619
+ /**
5620
+ * getter and setter for the volume of the artboard
5621
+ */
5622
+ get: function () {
5623
+ if (this.artboard && this.artboard.volume !== this._volume) {
5624
+ this._volume = this.artboard.volume;
5625
+ }
5626
+ return this._volume;
5627
+ },
5628
+ set: function (value) {
5629
+ this._volume = value;
5630
+ if (this.artboard) {
5631
+ this.artboard.volume = value;
5632
+ }
5633
+ },
5634
+ enumerable: false,
5635
+ configurable: true
5636
+ });
5614
5637
  // Error message for missing source or buffer
5615
5638
  Rive.missingErrorMessage = "Rive source file or data buffer required";
5616
5639
  return Rive;