@rive-app/webgl 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/webgl",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "Rive's webgl 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
@@ -395,7 +395,7 @@ function Ra(a, b) {
395
395
  return Qa(c, a, b);
396
396
  }));
397
397
  }
398
- var E, F, Va = {688572:(a, b, c, d, e) => {
398
+ var E, F, Va = {688588:(a, b, c, d, e) => {
399
399
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
400
400
  return 0;
401
401
  }
@@ -458,9 +458,9 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
458
458
  }
459
459
  window.h.Ea += 1;
460
460
  return 1;
461
- }, 690750:() => {
461
+ }, 690766:() => {
462
462
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
463
- }, 690914:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691018:() => {
463
+ }, 690930:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691034:() => {
464
464
  try {
465
465
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
466
466
  a.close();
@@ -468,7 +468,7 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
468
468
  } catch (c) {
469
469
  return 0;
470
470
  }
471
- }, 691189:(a, b, c, d, e, f) => {
471
+ }, 691205:(a, b, c, d, e, f) => {
472
472
  if ("undefined" === typeof window.h) {
473
473
  return -1;
474
474
  }
@@ -514,7 +514,7 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
514
514
  a == window.h.H.Da && g.Y.connect(g.I.destination);
515
515
  g.mb = f;
516
516
  return window.h.vc(g);
517
- }, 694066:a => window.h.ua(a).I.sampleRate, 694139:a => {
517
+ }, 694082:a => window.h.ua(a).I.sampleRate, 694155:a => {
518
518
  a = window.h.ua(a);
519
519
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
520
520
  }, a.Y.disconnect(), a.Y = void 0);
@@ -522,13 +522,13 @@ var E, F, Va = {688572:(a, b, c, d, e) => {
522
522
  a.I.close();
523
523
  a.I = void 0;
524
524
  a.mb = void 0;
525
- }, 694539:a => {
525
+ }, 694555:a => {
526
526
  window.h.yb(a);
527
- }, 694589:a => {
527
+ }, 694605:a => {
528
528
  a = window.h.ua(a);
529
529
  a.I.resume();
530
530
  a.state = window.h.ha.tb;
531
- }, 694728:a => {
531
+ }, 694744:a => {
532
532
  a = window.h.ua(a);
533
533
  a.I.suspend();
534
534
  a.state = window.h.ha.stopped;
@@ -4104,7 +4104,7 @@ Ie();
4104
4104
  /* 2 */
4105
4105
  /***/ ((module) => {
4106
4106
 
4107
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.14.0","description":"Rive\'s webgl 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.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4107
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.14.1","description":"Rive\'s webgl 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.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4108
4108
 
4109
4109
  /***/ }),
4110
4110
  /* 3 */
@@ -5364,6 +5364,8 @@ var Rive = /** @class */ (function () {
5364
5364
  this.automaticallyHandleEvents = false;
5365
5365
  // Allow the runtime to automatically load assets hosted in Rive's runtime.
5366
5366
  this.enableRiveAssetCDN = true;
5367
+ // Keep a local value of the set volume to update it asynchronously
5368
+ this._volume = 1;
5367
5369
  // Durations to generate a frame for the last second. Used for performance profiling.
5368
5370
  this.durations = [];
5369
5371
  this.frameTimes = [];
@@ -5494,7 +5496,8 @@ var Rive = /** @class */ (function () {
5494
5496
  .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
5495
5497
  .map(function (sm) { return sm.instance; });
5496
5498
  var touchScrollEnabledOption = this.isTouchScrollEnabled;
5497
- if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
5499
+ if (riveListenerOptions &&
5500
+ "isTouchScrollEnabled" in riveListenerOptions) {
5498
5501
  touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
5499
5502
  }
5500
5503
  this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
@@ -5584,6 +5587,7 @@ var Rive = /** @class */ (function () {
5584
5587
  return;
5585
5588
  }
5586
5589
  this.artboard = rootArtboard;
5590
+ rootArtboard.volume = this._volume;
5587
5591
  // Check that the artboard has at least 1 animation
5588
5592
  if (this.artboard.animationCount() < 1) {
5589
5593
  var msg = "Artboard has no animations";
@@ -6311,6 +6315,25 @@ var Rive = /** @class */ (function () {
6311
6315
  enumerable: false,
6312
6316
  configurable: true
6313
6317
  });
6318
+ Object.defineProperty(Rive.prototype, "volume", {
6319
+ /**
6320
+ * getter and setter for the volume of the artboard
6321
+ */
6322
+ get: function () {
6323
+ if (this.artboard && this.artboard.volume !== this._volume) {
6324
+ this._volume = this.artboard.volume;
6325
+ }
6326
+ return this._volume;
6327
+ },
6328
+ set: function (value) {
6329
+ this._volume = value;
6330
+ if (this.artboard) {
6331
+ this.artboard.volume = value;
6332
+ }
6333
+ },
6334
+ enumerable: false,
6335
+ configurable: true
6336
+ });
6314
6337
  // Error message for missing source or buffer
6315
6338
  Rive.missingErrorMessage = "Rive source file or data buffer required";
6316
6339
  return Rive;