@rive-app/canvas 2.14.0 → 2.14.2
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 +1 -1
- package/rive.d.ts +10 -2
- package/rive.js +230 -11
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +5 -0
package/package.json
CHANGED
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
|
|
2
|
+
export type { FileAsset, FontAsset, ImageAsset } from "./rive_advanced.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Generic type for a parameterless void callback
|
|
5
5
|
*/
|
|
@@ -117,7 +117,8 @@ export declare enum EventType {
|
|
|
117
117
|
Draw = "draw",
|
|
118
118
|
Advance = "advance",
|
|
119
119
|
StateChange = "statechange",
|
|
120
|
-
RiveEvent = "riveevent"
|
|
120
|
+
RiveEvent = "riveevent",
|
|
121
|
+
AudioStatusChange = "audiostatuschange"
|
|
121
122
|
}
|
|
122
123
|
export type RiveEventPayload = rc.RiveEvent | rc.OpenUrlEvent;
|
|
123
124
|
export interface Event {
|
|
@@ -304,12 +305,14 @@ export declare class Rive {
|
|
|
304
305
|
private shouldDisableRiveListeners;
|
|
305
306
|
private automaticallyHandleEvents;
|
|
306
307
|
private enableRiveAssetCDN;
|
|
308
|
+
private _volume;
|
|
307
309
|
durations: number[];
|
|
308
310
|
frameTimes: number[];
|
|
309
311
|
frameCount: number;
|
|
310
312
|
isTouchScrollEnabled: boolean;
|
|
311
313
|
constructor(params: RiveParameters);
|
|
312
314
|
static new(params: RiveParameters): Rive;
|
|
315
|
+
private onSystemAudioChanged;
|
|
313
316
|
private init;
|
|
314
317
|
/**
|
|
315
318
|
* Setup Rive Listeners on the canvas
|
|
@@ -525,6 +528,11 @@ export declare class Rive {
|
|
|
525
528
|
* Returns the contents of a Rive file: the artboards, animations, and state machines
|
|
526
529
|
*/
|
|
527
530
|
get contents(): RiveFileContents;
|
|
531
|
+
/**
|
|
532
|
+
* getter and setter for the volume of the artboard
|
|
533
|
+
*/
|
|
534
|
+
get volume(): number;
|
|
535
|
+
set volume(value: number);
|
|
528
536
|
}
|
|
529
537
|
/**
|
|
530
538
|
* Contents of a state machine input
|
package/rive.js
CHANGED
|
@@ -731,7 +731,7 @@ function Ya(a, b) {
|
|
|
731
731
|
return Xa(c, a, b);
|
|
732
732
|
}));
|
|
733
733
|
}
|
|
734
|
-
var N, P, bb = {
|
|
734
|
+
var N, P, bb = {433276:(a, b, c, d, e) => {
|
|
735
735
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
736
736
|
return 0;
|
|
737
737
|
}
|
|
@@ -794,9 +794,9 @@ var N, P, bb = {433284:(a, b, c, d, e) => {
|
|
|
794
794
|
}
|
|
795
795
|
window.h.Aa += 1;
|
|
796
796
|
return 1;
|
|
797
|
-
},
|
|
797
|
+
}, 435454:() => {
|
|
798
798
|
"undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
|
|
799
|
-
},
|
|
799
|
+
}, 435618:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 435722:() => {
|
|
800
800
|
try {
|
|
801
801
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
802
802
|
a.close();
|
|
@@ -804,7 +804,7 @@ var N, P, bb = {433284:(a, b, c, d, e) => {
|
|
|
804
804
|
} catch (c) {
|
|
805
805
|
return 0;
|
|
806
806
|
}
|
|
807
|
-
},
|
|
807
|
+
}, 435893:(a, b, c, d, e, f) => {
|
|
808
808
|
if ("undefined" === typeof window.h) {
|
|
809
809
|
return -1;
|
|
810
810
|
}
|
|
@@ -850,7 +850,7 @@ var N, P, bb = {433284:(a, b, c, d, e) => {
|
|
|
850
850
|
a == window.h.H.za && g.$.connect(g.I.destination);
|
|
851
851
|
g.qb = f;
|
|
852
852
|
return window.h.Gc(g);
|
|
853
|
-
},
|
|
853
|
+
}, 438770:a => window.h.sa(a).I.sampleRate, 438843:a => {
|
|
854
854
|
a = window.h.sa(a);
|
|
855
855
|
void 0 !== a.$ && (a.$.onaudioprocess = function() {
|
|
856
856
|
}, a.$.disconnect(), a.$ = void 0);
|
|
@@ -858,13 +858,13 @@ var N, P, bb = {433284:(a, b, c, d, e) => {
|
|
|
858
858
|
a.I.close();
|
|
859
859
|
a.I = void 0;
|
|
860
860
|
a.qb = void 0;
|
|
861
|
-
},
|
|
861
|
+
}, 439243:a => {
|
|
862
862
|
window.h.Db(a);
|
|
863
|
-
},
|
|
863
|
+
}, 439293:a => {
|
|
864
864
|
a = window.h.sa(a);
|
|
865
865
|
a.I.resume();
|
|
866
866
|
a.state = window.h.ga.yb;
|
|
867
|
-
},
|
|
867
|
+
}, 439432:a => {
|
|
868
868
|
a = window.h.sa(a);
|
|
869
869
|
a.I.suspend();
|
|
870
870
|
a.state = window.h.ga.stopped;
|
|
@@ -3336,8 +3336,8 @@ m._ma_malloc_emscripten = (a, b) => (m._ma_malloc_emscripten = x.ma_malloc_emscr
|
|
|
3336
3336
|
m._ma_free_emscripten = (a, b) => (m._ma_free_emscripten = x.ma_free_emscripten)(a, b);
|
|
3337
3337
|
var $a = m._ma_device_process_pcm_frames_capture__webaudio = (a, b, c) => ($a = m._ma_device_process_pcm_frames_capture__webaudio = x.ma_device_process_pcm_frames_capture__webaudio)(a, b, c), ab = m._ma_device_process_pcm_frames_playback__webaudio = (a, b, c) => (ab = m._ma_device_process_pcm_frames_playback__webaudio = x.ma_device_process_pcm_frames_playback__webaudio)(a, b, c), Ud = () => (Ud = x.__errno_location)(), Dc = a => (Dc = x.__getTypeName)(a);
|
|
3338
3338
|
m.__embind_initialize_bindings = () => (m.__embind_initialize_bindings = x._embind_initialize_bindings)();
|
|
3339
|
-
m.dynCall_iiji = (a, b, c, d, e) => (m.dynCall_iiji = x.dynCall_iiji)(a, b, c, d, e);
|
|
3340
3339
|
m.dynCall_iiiji = (a, b, c, d, e, f) => (m.dynCall_iiiji = x.dynCall_iiiji)(a, b, c, d, e, f);
|
|
3340
|
+
m.dynCall_iiji = (a, b, c, d, e) => (m.dynCall_iiji = x.dynCall_iiji)(a, b, c, d, e);
|
|
3341
3341
|
m.dynCall_jiji = (a, b, c, d, e) => (m.dynCall_jiji = x.dynCall_jiji)(a, b, c, d, e);
|
|
3342
3342
|
m.dynCall_iij = (a, b, c, d) => (m.dynCall_iij = x.dynCall_iij)(a, b, c, d);
|
|
3343
3343
|
m.dynCall_jii = (a, b, c) => (m.dynCall_jii = x.dynCall_jii)(a, b, c);
|
|
@@ -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.
|
|
3407
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.14.2","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 */
|
|
@@ -3708,6 +3708,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3708
3708
|
/* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
3709
3709
|
/* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
3710
3710
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
3711
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
3712
|
+
var extendStatics = function (d, b) {
|
|
3713
|
+
extendStatics = Object.setPrototypeOf ||
|
|
3714
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3715
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3716
|
+
return extendStatics(d, b);
|
|
3717
|
+
};
|
|
3718
|
+
return function (d, b) {
|
|
3719
|
+
if (typeof b !== "function" && b !== null)
|
|
3720
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3721
|
+
extendStatics(d, b);
|
|
3722
|
+
function __() { this.constructor = d; }
|
|
3723
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3724
|
+
};
|
|
3725
|
+
})();
|
|
3711
3726
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3712
3727
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3713
3728
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -4551,6 +4566,7 @@ var EventType;
|
|
|
4551
4566
|
EventType["Advance"] = "advance";
|
|
4552
4567
|
EventType["StateChange"] = "statechange";
|
|
4553
4568
|
EventType["RiveEvent"] = "riveevent";
|
|
4569
|
+
EventType["AudioStatusChange"] = "audiostatuschange";
|
|
4554
4570
|
})(EventType || (EventType = {}));
|
|
4555
4571
|
/**
|
|
4556
4572
|
* Looping types: one-shot, loop, and ping-pong
|
|
@@ -4643,8 +4659,176 @@ var TaskQueueManager = /** @class */ (function () {
|
|
|
4643
4659
|
};
|
|
4644
4660
|
return TaskQueueManager;
|
|
4645
4661
|
}());
|
|
4662
|
+
// #endregion
|
|
4663
|
+
// #region Audio
|
|
4664
|
+
var SystemAudioStatus;
|
|
4665
|
+
(function (SystemAudioStatus) {
|
|
4666
|
+
SystemAudioStatus[SystemAudioStatus["AVAILABLE"] = 0] = "AVAILABLE";
|
|
4667
|
+
SystemAudioStatus[SystemAudioStatus["UNAVAILABLE"] = 1] = "UNAVAILABLE";
|
|
4668
|
+
})(SystemAudioStatus || (SystemAudioStatus = {}));
|
|
4669
|
+
// Class to handle audio context availability and status changes
|
|
4670
|
+
var AudioManager = /** @class */ (function (_super) {
|
|
4671
|
+
__extends(AudioManager, _super);
|
|
4672
|
+
function AudioManager() {
|
|
4673
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4674
|
+
_this._started = false;
|
|
4675
|
+
_this._enabled = false;
|
|
4676
|
+
_this._status = SystemAudioStatus.UNAVAILABLE;
|
|
4677
|
+
return _this;
|
|
4678
|
+
}
|
|
4679
|
+
AudioManager.prototype.delay = function (time) {
|
|
4680
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4681
|
+
return __generator(this, function (_a) {
|
|
4682
|
+
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, time); })];
|
|
4683
|
+
});
|
|
4684
|
+
});
|
|
4685
|
+
};
|
|
4686
|
+
AudioManager.prototype.timeout = function () {
|
|
4687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4688
|
+
return __generator(this, function (_a) {
|
|
4689
|
+
return [2 /*return*/, new Promise(function (_, reject) { return setTimeout(reject, 50); })];
|
|
4690
|
+
});
|
|
4691
|
+
});
|
|
4692
|
+
};
|
|
4693
|
+
// Alerts animations on status changes and removes the listeners to avoid alerting twice.
|
|
4694
|
+
AudioManager.prototype.reportToListeners = function () {
|
|
4695
|
+
this.fire({ type: EventType.AudioStatusChange });
|
|
4696
|
+
this.removeAll();
|
|
4697
|
+
};
|
|
4698
|
+
/**
|
|
4699
|
+
* The audio context has been resolved.
|
|
4700
|
+
* Alert any listeners that we can now play audio.
|
|
4701
|
+
* Rive will now play audio at the configured volume.
|
|
4702
|
+
*/
|
|
4703
|
+
AudioManager.prototype.enableAudio = function () {
|
|
4704
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4705
|
+
return __generator(this, function (_a) {
|
|
4706
|
+
if (!this._enabled) {
|
|
4707
|
+
this._enabled = true;
|
|
4708
|
+
this._status = SystemAudioStatus.AVAILABLE;
|
|
4709
|
+
this.reportToListeners();
|
|
4710
|
+
}
|
|
4711
|
+
return [2 /*return*/];
|
|
4712
|
+
});
|
|
4713
|
+
});
|
|
4714
|
+
};
|
|
4715
|
+
/**
|
|
4716
|
+
* Check if we are able to play audio.
|
|
4717
|
+
*
|
|
4718
|
+
* We currently check the audio context, when resume() returns before a timeout we know that the
|
|
4719
|
+
* audio context is running and we can enable audio.
|
|
4720
|
+
*/
|
|
4721
|
+
AudioManager.prototype.testAudio = function () {
|
|
4722
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4723
|
+
var _a;
|
|
4724
|
+
return __generator(this, function (_b) {
|
|
4725
|
+
switch (_b.label) {
|
|
4726
|
+
case 0:
|
|
4727
|
+
if (!(this._status === SystemAudioStatus.UNAVAILABLE &&
|
|
4728
|
+
this._audioContext !== null)) return [3 /*break*/, 4];
|
|
4729
|
+
_b.label = 1;
|
|
4730
|
+
case 1:
|
|
4731
|
+
_b.trys.push([1, 3, , 4]);
|
|
4732
|
+
return [4 /*yield*/, Promise.race([this._audioContext.resume(), this.timeout()])];
|
|
4733
|
+
case 2:
|
|
4734
|
+
_b.sent();
|
|
4735
|
+
this.enableAudio();
|
|
4736
|
+
return [3 /*break*/, 4];
|
|
4737
|
+
case 3:
|
|
4738
|
+
_a = _b.sent();
|
|
4739
|
+
return [3 /*break*/, 4];
|
|
4740
|
+
case 4: return [2 /*return*/];
|
|
4741
|
+
}
|
|
4742
|
+
});
|
|
4743
|
+
});
|
|
4744
|
+
};
|
|
4745
|
+
/**
|
|
4746
|
+
* Establish audio for use with rive.
|
|
4747
|
+
* We both test if we can use audio intermittently and listen for user interaction.
|
|
4748
|
+
* The aim is to enable audio playback as soon as the browser allows this.
|
|
4749
|
+
*/
|
|
4750
|
+
AudioManager.prototype._establishAudio = function () {
|
|
4751
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4752
|
+
return __generator(this, function (_a) {
|
|
4753
|
+
switch (_a.label) {
|
|
4754
|
+
case 0:
|
|
4755
|
+
if (!!this._started) return [3 /*break*/, 5];
|
|
4756
|
+
this._started = true;
|
|
4757
|
+
if (!(typeof window == "undefined")) return [3 /*break*/, 1];
|
|
4758
|
+
this.enableAudio();
|
|
4759
|
+
return [3 /*break*/, 5];
|
|
4760
|
+
case 1:
|
|
4761
|
+
this._audioContext = new AudioContext();
|
|
4762
|
+
this.listenForUserAction();
|
|
4763
|
+
_a.label = 2;
|
|
4764
|
+
case 2:
|
|
4765
|
+
if (!(this._status === SystemAudioStatus.UNAVAILABLE)) return [3 /*break*/, 5];
|
|
4766
|
+
return [4 /*yield*/, this.testAudio()];
|
|
4767
|
+
case 3:
|
|
4768
|
+
_a.sent();
|
|
4769
|
+
return [4 /*yield*/, this.delay(1000)];
|
|
4770
|
+
case 4:
|
|
4771
|
+
_a.sent();
|
|
4772
|
+
return [3 /*break*/, 2];
|
|
4773
|
+
case 5: return [2 /*return*/];
|
|
4774
|
+
}
|
|
4775
|
+
});
|
|
4776
|
+
});
|
|
4777
|
+
};
|
|
4778
|
+
AudioManager.prototype.listenForUserAction = function () {
|
|
4779
|
+
var _this = this;
|
|
4780
|
+
// NOTE: AudioContexts are ready immediately if requested in a ui callback
|
|
4781
|
+
// we *could* re request one in this listener.
|
|
4782
|
+
var _clickListener = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4783
|
+
return __generator(this, function (_a) {
|
|
4784
|
+
// note this has "better" results than calling `await this.testAudio()`
|
|
4785
|
+
// as we force audio to be enabled in the current thread, rather than chancing
|
|
4786
|
+
// the thread to be passed over for some other async context
|
|
4787
|
+
this.enableAudio();
|
|
4788
|
+
return [2 /*return*/];
|
|
4789
|
+
});
|
|
4790
|
+
}); };
|
|
4791
|
+
// NOTE: we should test this on mobile/pads
|
|
4792
|
+
document.addEventListener("pointerdown", _clickListener, {
|
|
4793
|
+
once: true,
|
|
4794
|
+
});
|
|
4795
|
+
};
|
|
4796
|
+
/**
|
|
4797
|
+
* Establish the audio context for rive, this lets rive know that we can play audio.
|
|
4798
|
+
*/
|
|
4799
|
+
AudioManager.prototype.establishAudio = function () {
|
|
4800
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4801
|
+
return __generator(this, function (_a) {
|
|
4802
|
+
this._establishAudio();
|
|
4803
|
+
return [2 /*return*/];
|
|
4804
|
+
});
|
|
4805
|
+
});
|
|
4806
|
+
};
|
|
4807
|
+
Object.defineProperty(AudioManager.prototype, "systemVolume", {
|
|
4808
|
+
get: function () {
|
|
4809
|
+
if (this._status === SystemAudioStatus.UNAVAILABLE) {
|
|
4810
|
+
// We do an immediate test to avoid depending on the delay of the running test
|
|
4811
|
+
this.testAudio();
|
|
4812
|
+
return 0;
|
|
4813
|
+
}
|
|
4814
|
+
return 1;
|
|
4815
|
+
},
|
|
4816
|
+
enumerable: false,
|
|
4817
|
+
configurable: true
|
|
4818
|
+
});
|
|
4819
|
+
Object.defineProperty(AudioManager.prototype, "status", {
|
|
4820
|
+
get: function () {
|
|
4821
|
+
return this._status;
|
|
4822
|
+
},
|
|
4823
|
+
enumerable: false,
|
|
4824
|
+
configurable: true
|
|
4825
|
+
});
|
|
4826
|
+
return AudioManager;
|
|
4827
|
+
}(EventManager));
|
|
4828
|
+
var audioManager = new AudioManager();
|
|
4646
4829
|
var Rive = /** @class */ (function () {
|
|
4647
4830
|
function Rive(params) {
|
|
4831
|
+
var _this = this;
|
|
4648
4832
|
var _a;
|
|
4649
4833
|
// Tracks if a Rive file is loaded
|
|
4650
4834
|
this.loaded = false;
|
|
@@ -4664,6 +4848,8 @@ var Rive = /** @class */ (function () {
|
|
|
4664
4848
|
this.automaticallyHandleEvents = false;
|
|
4665
4849
|
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
4666
4850
|
this.enableRiveAssetCDN = true;
|
|
4851
|
+
// Keep a local value of the set volume to update it asynchronously
|
|
4852
|
+
this._volume = 1;
|
|
4667
4853
|
// Durations to generate a frame for the last second. Used for performance profiling.
|
|
4668
4854
|
this.durations = [];
|
|
4669
4855
|
this.frameTimes = [];
|
|
@@ -4727,6 +4913,14 @@ var Rive = /** @class */ (function () {
|
|
|
4727
4913
|
this.assetLoader = params.assetLoader;
|
|
4728
4914
|
// Hook up the task queue
|
|
4729
4915
|
this.taskQueue = new TaskQueueManager(this.eventManager);
|
|
4916
|
+
// Initialize audio
|
|
4917
|
+
if (audioManager.status == SystemAudioStatus.UNAVAILABLE) {
|
|
4918
|
+
audioManager.add({
|
|
4919
|
+
type: EventType.AudioStatusChange,
|
|
4920
|
+
callback: function () { return _this.onSystemAudioChanged(); },
|
|
4921
|
+
});
|
|
4922
|
+
audioManager.establishAudio();
|
|
4923
|
+
}
|
|
4730
4924
|
this.init({
|
|
4731
4925
|
src: this.src,
|
|
4732
4926
|
buffer: this.buffer,
|
|
@@ -4742,6 +4936,10 @@ var Rive = /** @class */ (function () {
|
|
|
4742
4936
|
console.warn("This function is deprecated: please use `new Rive({})` instead");
|
|
4743
4937
|
return new Rive(params);
|
|
4744
4938
|
};
|
|
4939
|
+
// Event handler for when audio context becomes available
|
|
4940
|
+
Rive.prototype.onSystemAudioChanged = function () {
|
|
4941
|
+
this.volume = this._volume;
|
|
4942
|
+
};
|
|
4745
4943
|
// Initializes the Rive object either from constructor or load()
|
|
4746
4944
|
Rive.prototype.init = function (_a) {
|
|
4747
4945
|
var _this = this;
|
|
@@ -4794,7 +4992,8 @@ var Rive = /** @class */ (function () {
|
|
|
4794
4992
|
.filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
|
|
4795
4993
|
.map(function (sm) { return sm.instance; });
|
|
4796
4994
|
var touchScrollEnabledOption = this.isTouchScrollEnabled;
|
|
4797
|
-
if (riveListenerOptions &&
|
|
4995
|
+
if (riveListenerOptions &&
|
|
4996
|
+
"isTouchScrollEnabled" in riveListenerOptions) {
|
|
4798
4997
|
touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
|
|
4799
4998
|
}
|
|
4800
4999
|
this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
|
|
@@ -4884,6 +5083,7 @@ var Rive = /** @class */ (function () {
|
|
|
4884
5083
|
return;
|
|
4885
5084
|
}
|
|
4886
5085
|
this.artboard = rootArtboard;
|
|
5086
|
+
rootArtboard.volume = this._volume * audioManager.systemVolume;
|
|
4887
5087
|
// Check that the artboard has at least 1 animation
|
|
4888
5088
|
if (this.artboard.animationCount() < 1) {
|
|
4889
5089
|
var msg = "Artboard has no animations";
|
|
@@ -5611,6 +5811,25 @@ var Rive = /** @class */ (function () {
|
|
|
5611
5811
|
enumerable: false,
|
|
5612
5812
|
configurable: true
|
|
5613
5813
|
});
|
|
5814
|
+
Object.defineProperty(Rive.prototype, "volume", {
|
|
5815
|
+
/**
|
|
5816
|
+
* getter and setter for the volume of the artboard
|
|
5817
|
+
*/
|
|
5818
|
+
get: function () {
|
|
5819
|
+
if (this.artboard && this.artboard.volume !== this._volume) {
|
|
5820
|
+
this._volume = this.artboard.volume;
|
|
5821
|
+
}
|
|
5822
|
+
return this._volume;
|
|
5823
|
+
},
|
|
5824
|
+
set: function (value) {
|
|
5825
|
+
this._volume = value;
|
|
5826
|
+
if (this.artboard) {
|
|
5827
|
+
this.artboard.volume = value * audioManager.systemVolume;
|
|
5828
|
+
}
|
|
5829
|
+
},
|
|
5830
|
+
enumerable: false,
|
|
5831
|
+
configurable: true
|
|
5832
|
+
});
|
|
5614
5833
|
// Error message for missing source or buffer
|
|
5615
5834
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|
|
5616
5835
|
return Rive;
|