@rive-app/webgl2 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 +231 -12
- 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
|
@@ -410,7 +410,7 @@ function Pa(a, b) {
|
|
|
410
410
|
return Oa(c, a, b);
|
|
411
411
|
}));
|
|
412
412
|
}
|
|
413
|
-
var J, K, Ta = {
|
|
413
|
+
var J, K, Ta = {473712:(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 = {473560:(a, b, c, d, e) => {
|
|
|
473
473
|
}
|
|
474
474
|
window.h.Da += 1;
|
|
475
475
|
return 1;
|
|
476
|
-
},
|
|
476
|
+
}, 475890:() => {
|
|
477
477
|
"undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
|
|
478
|
-
},
|
|
478
|
+
}, 476054:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476158:() => {
|
|
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 = {473560:(a, b, c, d, e) => {
|
|
|
483
483
|
} catch (c) {
|
|
484
484
|
return 0;
|
|
485
485
|
}
|
|
486
|
-
},
|
|
486
|
+
}, 476329:(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 = {473560:(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
|
-
},
|
|
532
|
+
}, 479206:a => window.h.wa(a).J.sampleRate, 479279: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 = {473560:(a, b, c, d, e) => {
|
|
|
537
537
|
a.J.close();
|
|
538
538
|
a.J = void 0;
|
|
539
539
|
a.kb = void 0;
|
|
540
|
-
},
|
|
540
|
+
}, 479679:a => {
|
|
541
541
|
window.h.xb(a);
|
|
542
|
-
},
|
|
542
|
+
}, 479729:a => {
|
|
543
543
|
a = window.h.wa(a);
|
|
544
544
|
a.J.resume();
|
|
545
545
|
a.state = window.h.ha.sb;
|
|
546
|
-
},
|
|
546
|
+
}, 479868: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 =
|
|
3552
|
-
n.___stop_em_js =
|
|
3551
|
+
n.___start_em_js = 471088;
|
|
3552
|
+
n.___stop_em_js = 473712;
|
|
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.14.
|
|
3612
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.14.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}}');
|
|
3613
3613
|
|
|
3614
3614
|
/***/ }),
|
|
3615
3615
|
/* 3 */
|
|
@@ -3913,6 +3913,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3913
3913
|
/* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
3914
3914
|
/* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
3915
3915
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
3916
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
3917
|
+
var extendStatics = function (d, b) {
|
|
3918
|
+
extendStatics = Object.setPrototypeOf ||
|
|
3919
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3920
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3921
|
+
return extendStatics(d, b);
|
|
3922
|
+
};
|
|
3923
|
+
return function (d, b) {
|
|
3924
|
+
if (typeof b !== "function" && b !== null)
|
|
3925
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3926
|
+
extendStatics(d, b);
|
|
3927
|
+
function __() { this.constructor = d; }
|
|
3928
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3929
|
+
};
|
|
3930
|
+
})();
|
|
3916
3931
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3917
3932
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3918
3933
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -4756,6 +4771,7 @@ var EventType;
|
|
|
4756
4771
|
EventType["Advance"] = "advance";
|
|
4757
4772
|
EventType["StateChange"] = "statechange";
|
|
4758
4773
|
EventType["RiveEvent"] = "riveevent";
|
|
4774
|
+
EventType["AudioStatusChange"] = "audiostatuschange";
|
|
4759
4775
|
})(EventType || (EventType = {}));
|
|
4760
4776
|
/**
|
|
4761
4777
|
* Looping types: one-shot, loop, and ping-pong
|
|
@@ -4848,8 +4864,176 @@ var TaskQueueManager = /** @class */ (function () {
|
|
|
4848
4864
|
};
|
|
4849
4865
|
return TaskQueueManager;
|
|
4850
4866
|
}());
|
|
4867
|
+
// #endregion
|
|
4868
|
+
// #region Audio
|
|
4869
|
+
var SystemAudioStatus;
|
|
4870
|
+
(function (SystemAudioStatus) {
|
|
4871
|
+
SystemAudioStatus[SystemAudioStatus["AVAILABLE"] = 0] = "AVAILABLE";
|
|
4872
|
+
SystemAudioStatus[SystemAudioStatus["UNAVAILABLE"] = 1] = "UNAVAILABLE";
|
|
4873
|
+
})(SystemAudioStatus || (SystemAudioStatus = {}));
|
|
4874
|
+
// Class to handle audio context availability and status changes
|
|
4875
|
+
var AudioManager = /** @class */ (function (_super) {
|
|
4876
|
+
__extends(AudioManager, _super);
|
|
4877
|
+
function AudioManager() {
|
|
4878
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4879
|
+
_this._started = false;
|
|
4880
|
+
_this._enabled = false;
|
|
4881
|
+
_this._status = SystemAudioStatus.UNAVAILABLE;
|
|
4882
|
+
return _this;
|
|
4883
|
+
}
|
|
4884
|
+
AudioManager.prototype.delay = function (time) {
|
|
4885
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4886
|
+
return __generator(this, function (_a) {
|
|
4887
|
+
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, time); })];
|
|
4888
|
+
});
|
|
4889
|
+
});
|
|
4890
|
+
};
|
|
4891
|
+
AudioManager.prototype.timeout = function () {
|
|
4892
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4893
|
+
return __generator(this, function (_a) {
|
|
4894
|
+
return [2 /*return*/, new Promise(function (_, reject) { return setTimeout(reject, 50); })];
|
|
4895
|
+
});
|
|
4896
|
+
});
|
|
4897
|
+
};
|
|
4898
|
+
// Alerts animations on status changes and removes the listeners to avoid alerting twice.
|
|
4899
|
+
AudioManager.prototype.reportToListeners = function () {
|
|
4900
|
+
this.fire({ type: EventType.AudioStatusChange });
|
|
4901
|
+
this.removeAll();
|
|
4902
|
+
};
|
|
4903
|
+
/**
|
|
4904
|
+
* The audio context has been resolved.
|
|
4905
|
+
* Alert any listeners that we can now play audio.
|
|
4906
|
+
* Rive will now play audio at the configured volume.
|
|
4907
|
+
*/
|
|
4908
|
+
AudioManager.prototype.enableAudio = function () {
|
|
4909
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4910
|
+
return __generator(this, function (_a) {
|
|
4911
|
+
if (!this._enabled) {
|
|
4912
|
+
this._enabled = true;
|
|
4913
|
+
this._status = SystemAudioStatus.AVAILABLE;
|
|
4914
|
+
this.reportToListeners();
|
|
4915
|
+
}
|
|
4916
|
+
return [2 /*return*/];
|
|
4917
|
+
});
|
|
4918
|
+
});
|
|
4919
|
+
};
|
|
4920
|
+
/**
|
|
4921
|
+
* Check if we are able to play audio.
|
|
4922
|
+
*
|
|
4923
|
+
* We currently check the audio context, when resume() returns before a timeout we know that the
|
|
4924
|
+
* audio context is running and we can enable audio.
|
|
4925
|
+
*/
|
|
4926
|
+
AudioManager.prototype.testAudio = function () {
|
|
4927
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4928
|
+
var _a;
|
|
4929
|
+
return __generator(this, function (_b) {
|
|
4930
|
+
switch (_b.label) {
|
|
4931
|
+
case 0:
|
|
4932
|
+
if (!(this._status === SystemAudioStatus.UNAVAILABLE &&
|
|
4933
|
+
this._audioContext !== null)) return [3 /*break*/, 4];
|
|
4934
|
+
_b.label = 1;
|
|
4935
|
+
case 1:
|
|
4936
|
+
_b.trys.push([1, 3, , 4]);
|
|
4937
|
+
return [4 /*yield*/, Promise.race([this._audioContext.resume(), this.timeout()])];
|
|
4938
|
+
case 2:
|
|
4939
|
+
_b.sent();
|
|
4940
|
+
this.enableAudio();
|
|
4941
|
+
return [3 /*break*/, 4];
|
|
4942
|
+
case 3:
|
|
4943
|
+
_a = _b.sent();
|
|
4944
|
+
return [3 /*break*/, 4];
|
|
4945
|
+
case 4: return [2 /*return*/];
|
|
4946
|
+
}
|
|
4947
|
+
});
|
|
4948
|
+
});
|
|
4949
|
+
};
|
|
4950
|
+
/**
|
|
4951
|
+
* Establish audio for use with rive.
|
|
4952
|
+
* We both test if we can use audio intermittently and listen for user interaction.
|
|
4953
|
+
* The aim is to enable audio playback as soon as the browser allows this.
|
|
4954
|
+
*/
|
|
4955
|
+
AudioManager.prototype._establishAudio = function () {
|
|
4956
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4957
|
+
return __generator(this, function (_a) {
|
|
4958
|
+
switch (_a.label) {
|
|
4959
|
+
case 0:
|
|
4960
|
+
if (!!this._started) return [3 /*break*/, 5];
|
|
4961
|
+
this._started = true;
|
|
4962
|
+
if (!(typeof window == "undefined")) return [3 /*break*/, 1];
|
|
4963
|
+
this.enableAudio();
|
|
4964
|
+
return [3 /*break*/, 5];
|
|
4965
|
+
case 1:
|
|
4966
|
+
this._audioContext = new AudioContext();
|
|
4967
|
+
this.listenForUserAction();
|
|
4968
|
+
_a.label = 2;
|
|
4969
|
+
case 2:
|
|
4970
|
+
if (!(this._status === SystemAudioStatus.UNAVAILABLE)) return [3 /*break*/, 5];
|
|
4971
|
+
return [4 /*yield*/, this.testAudio()];
|
|
4972
|
+
case 3:
|
|
4973
|
+
_a.sent();
|
|
4974
|
+
return [4 /*yield*/, this.delay(1000)];
|
|
4975
|
+
case 4:
|
|
4976
|
+
_a.sent();
|
|
4977
|
+
return [3 /*break*/, 2];
|
|
4978
|
+
case 5: return [2 /*return*/];
|
|
4979
|
+
}
|
|
4980
|
+
});
|
|
4981
|
+
});
|
|
4982
|
+
};
|
|
4983
|
+
AudioManager.prototype.listenForUserAction = function () {
|
|
4984
|
+
var _this = this;
|
|
4985
|
+
// NOTE: AudioContexts are ready immediately if requested in a ui callback
|
|
4986
|
+
// we *could* re request one in this listener.
|
|
4987
|
+
var _clickListener = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4988
|
+
return __generator(this, function (_a) {
|
|
4989
|
+
// note this has "better" results than calling `await this.testAudio()`
|
|
4990
|
+
// as we force audio to be enabled in the current thread, rather than chancing
|
|
4991
|
+
// the thread to be passed over for some other async context
|
|
4992
|
+
this.enableAudio();
|
|
4993
|
+
return [2 /*return*/];
|
|
4994
|
+
});
|
|
4995
|
+
}); };
|
|
4996
|
+
// NOTE: we should test this on mobile/pads
|
|
4997
|
+
document.addEventListener("pointerdown", _clickListener, {
|
|
4998
|
+
once: true,
|
|
4999
|
+
});
|
|
5000
|
+
};
|
|
5001
|
+
/**
|
|
5002
|
+
* Establish the audio context for rive, this lets rive know that we can play audio.
|
|
5003
|
+
*/
|
|
5004
|
+
AudioManager.prototype.establishAudio = function () {
|
|
5005
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5006
|
+
return __generator(this, function (_a) {
|
|
5007
|
+
this._establishAudio();
|
|
5008
|
+
return [2 /*return*/];
|
|
5009
|
+
});
|
|
5010
|
+
});
|
|
5011
|
+
};
|
|
5012
|
+
Object.defineProperty(AudioManager.prototype, "systemVolume", {
|
|
5013
|
+
get: function () {
|
|
5014
|
+
if (this._status === SystemAudioStatus.UNAVAILABLE) {
|
|
5015
|
+
// We do an immediate test to avoid depending on the delay of the running test
|
|
5016
|
+
this.testAudio();
|
|
5017
|
+
return 0;
|
|
5018
|
+
}
|
|
5019
|
+
return 1;
|
|
5020
|
+
},
|
|
5021
|
+
enumerable: false,
|
|
5022
|
+
configurable: true
|
|
5023
|
+
});
|
|
5024
|
+
Object.defineProperty(AudioManager.prototype, "status", {
|
|
5025
|
+
get: function () {
|
|
5026
|
+
return this._status;
|
|
5027
|
+
},
|
|
5028
|
+
enumerable: false,
|
|
5029
|
+
configurable: true
|
|
5030
|
+
});
|
|
5031
|
+
return AudioManager;
|
|
5032
|
+
}(EventManager));
|
|
5033
|
+
var audioManager = new AudioManager();
|
|
4851
5034
|
var Rive = /** @class */ (function () {
|
|
4852
5035
|
function Rive(params) {
|
|
5036
|
+
var _this = this;
|
|
4853
5037
|
var _a;
|
|
4854
5038
|
// Tracks if a Rive file is loaded
|
|
4855
5039
|
this.loaded = false;
|
|
@@ -4869,6 +5053,8 @@ var Rive = /** @class */ (function () {
|
|
|
4869
5053
|
this.automaticallyHandleEvents = false;
|
|
4870
5054
|
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
4871
5055
|
this.enableRiveAssetCDN = true;
|
|
5056
|
+
// Keep a local value of the set volume to update it asynchronously
|
|
5057
|
+
this._volume = 1;
|
|
4872
5058
|
// Durations to generate a frame for the last second. Used for performance profiling.
|
|
4873
5059
|
this.durations = [];
|
|
4874
5060
|
this.frameTimes = [];
|
|
@@ -4932,6 +5118,14 @@ var Rive = /** @class */ (function () {
|
|
|
4932
5118
|
this.assetLoader = params.assetLoader;
|
|
4933
5119
|
// Hook up the task queue
|
|
4934
5120
|
this.taskQueue = new TaskQueueManager(this.eventManager);
|
|
5121
|
+
// Initialize audio
|
|
5122
|
+
if (audioManager.status == SystemAudioStatus.UNAVAILABLE) {
|
|
5123
|
+
audioManager.add({
|
|
5124
|
+
type: EventType.AudioStatusChange,
|
|
5125
|
+
callback: function () { return _this.onSystemAudioChanged(); },
|
|
5126
|
+
});
|
|
5127
|
+
audioManager.establishAudio();
|
|
5128
|
+
}
|
|
4935
5129
|
this.init({
|
|
4936
5130
|
src: this.src,
|
|
4937
5131
|
buffer: this.buffer,
|
|
@@ -4947,6 +5141,10 @@ var Rive = /** @class */ (function () {
|
|
|
4947
5141
|
console.warn("This function is deprecated: please use `new Rive({})` instead");
|
|
4948
5142
|
return new Rive(params);
|
|
4949
5143
|
};
|
|
5144
|
+
// Event handler for when audio context becomes available
|
|
5145
|
+
Rive.prototype.onSystemAudioChanged = function () {
|
|
5146
|
+
this.volume = this._volume;
|
|
5147
|
+
};
|
|
4950
5148
|
// Initializes the Rive object either from constructor or load()
|
|
4951
5149
|
Rive.prototype.init = function (_a) {
|
|
4952
5150
|
var _this = this;
|
|
@@ -4999,7 +5197,8 @@ var Rive = /** @class */ (function () {
|
|
|
4999
5197
|
.filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
|
|
5000
5198
|
.map(function (sm) { return sm.instance; });
|
|
5001
5199
|
var touchScrollEnabledOption = this.isTouchScrollEnabled;
|
|
5002
|
-
if (riveListenerOptions &&
|
|
5200
|
+
if (riveListenerOptions &&
|
|
5201
|
+
"isTouchScrollEnabled" in riveListenerOptions) {
|
|
5003
5202
|
touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
|
|
5004
5203
|
}
|
|
5005
5204
|
this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
|
|
@@ -5089,6 +5288,7 @@ var Rive = /** @class */ (function () {
|
|
|
5089
5288
|
return;
|
|
5090
5289
|
}
|
|
5091
5290
|
this.artboard = rootArtboard;
|
|
5291
|
+
rootArtboard.volume = this._volume * audioManager.systemVolume;
|
|
5092
5292
|
// Check that the artboard has at least 1 animation
|
|
5093
5293
|
if (this.artboard.animationCount() < 1) {
|
|
5094
5294
|
var msg = "Artboard has no animations";
|
|
@@ -5816,6 +6016,25 @@ var Rive = /** @class */ (function () {
|
|
|
5816
6016
|
enumerable: false,
|
|
5817
6017
|
configurable: true
|
|
5818
6018
|
});
|
|
6019
|
+
Object.defineProperty(Rive.prototype, "volume", {
|
|
6020
|
+
/**
|
|
6021
|
+
* getter and setter for the volume of the artboard
|
|
6022
|
+
*/
|
|
6023
|
+
get: function () {
|
|
6024
|
+
if (this.artboard && this.artboard.volume !== this._volume) {
|
|
6025
|
+
this._volume = this.artboard.volume;
|
|
6026
|
+
}
|
|
6027
|
+
return this._volume;
|
|
6028
|
+
},
|
|
6029
|
+
set: function (value) {
|
|
6030
|
+
this._volume = value;
|
|
6031
|
+
if (this.artboard) {
|
|
6032
|
+
this.artboard.volume = value * audioManager.systemVolume;
|
|
6033
|
+
}
|
|
6034
|
+
},
|
|
6035
|
+
enumerable: false,
|
|
6036
|
+
configurable: true
|
|
6037
|
+
});
|
|
5819
6038
|
// Error message for missing source or buffer
|
|
5820
6039
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|
|
5821
6040
|
return Rive;
|