@rive-app/webgl2 2.14.4 → 2.15.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 +1 -1
- package/rive.d.ts +18 -3
- package/rive.js +150 -56
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +27 -4
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 "./rive_advanced.mjs";
|
|
2
|
+
export type { FileAsset, AudioAsset, FontAsset, ImageAsset, } from "./rive_advanced.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Generic type for a parameterless void callback
|
|
5
5
|
*/
|
|
@@ -285,6 +285,7 @@ export declare class Rive {
|
|
|
285
285
|
private _layout;
|
|
286
286
|
private renderer;
|
|
287
287
|
private loaded;
|
|
288
|
+
private _observed;
|
|
288
289
|
/**
|
|
289
290
|
* Tracks if a Rive file is loaded; we need this in addition to loaded as some
|
|
290
291
|
* commands (e.g. contents) can be called as soon as the file is loaded.
|
|
@@ -306,6 +307,7 @@ export declare class Rive {
|
|
|
306
307
|
private automaticallyHandleEvents;
|
|
307
308
|
private enableRiveAssetCDN;
|
|
308
309
|
private _volume;
|
|
310
|
+
private _hasZeroSize;
|
|
309
311
|
durations: number[];
|
|
310
312
|
frameTimes: number[];
|
|
311
313
|
frameCount: number;
|
|
@@ -313,6 +315,7 @@ export declare class Rive {
|
|
|
313
315
|
constructor(params: RiveParameters);
|
|
314
316
|
static new(params: RiveParameters): Rive;
|
|
315
317
|
private onSystemAudioChanged;
|
|
318
|
+
private onCanvasResize;
|
|
316
319
|
private init;
|
|
317
320
|
/**
|
|
318
321
|
* Setup Rive Listeners on the canvas
|
|
@@ -325,6 +328,11 @@ export declare class Rive {
|
|
|
325
328
|
* Remove Rive Listeners setup on the canvas
|
|
326
329
|
*/
|
|
327
330
|
removeRiveListeners(): void;
|
|
331
|
+
/**
|
|
332
|
+
* If the instance has audio and the system audio is not ready
|
|
333
|
+
* we hook the instance to the audio manager
|
|
334
|
+
*/
|
|
335
|
+
private initializeAudio;
|
|
328
336
|
private initData;
|
|
329
337
|
private initArtboard;
|
|
330
338
|
drawFrame(): void;
|
|
@@ -567,17 +575,24 @@ export declare const Testing: {
|
|
|
567
575
|
EventManager: typeof EventManager;
|
|
568
576
|
TaskQueueManager: typeof TaskQueueManager;
|
|
569
577
|
};
|
|
578
|
+
/**
|
|
579
|
+
* Decodes bytes into an audio asset.
|
|
580
|
+
*
|
|
581
|
+
* Be sure to call `.unref()` on the audio once it is no longer needed. This
|
|
582
|
+
* allows the engine to clean it up when it is not used by any more animations.
|
|
583
|
+
*/
|
|
584
|
+
export declare const decodeAudio: (bytes: Uint8Array) => Promise<rc.Audio>;
|
|
570
585
|
/**
|
|
571
586
|
* Decodes bytes into an image.
|
|
572
587
|
*
|
|
573
|
-
* Be sure to call `.
|
|
588
|
+
* Be sure to call `.unref()` on the image once it is no longer needed. This
|
|
574
589
|
* allows the engine to clean it up when it is not used by any more animations.
|
|
575
590
|
*/
|
|
576
591
|
export declare const decodeImage: (bytes: Uint8Array) => Promise<rc.Image>;
|
|
577
592
|
/**
|
|
578
593
|
* Decodes bytes into a font.
|
|
579
594
|
*
|
|
580
|
-
* Be sure to call `.
|
|
595
|
+
* Be sure to call `.unref()` on the font once it is no longer needed. This
|
|
581
596
|
* allows the engine to clean it up when it is not used by any more animations.
|
|
582
597
|
*/
|
|
583
598
|
export declare const decodeFont: (bytes: Uint8Array) => Promise<rc.Font>;
|
package/rive.js
CHANGED
|
@@ -91,52 +91,57 @@ function ea() {
|
|
|
91
91
|
const fa = n.onRuntimeInitialized;
|
|
92
92
|
n.onRuntimeInitialized = function() {
|
|
93
93
|
fa && fa();
|
|
94
|
-
let a = n.
|
|
95
|
-
n.
|
|
96
|
-
|
|
97
|
-
d
|
|
94
|
+
let a = n.decodeAudio;
|
|
95
|
+
n.decodeAudio = function(d, e) {
|
|
96
|
+
d = a(d);
|
|
97
|
+
e(d);
|
|
98
98
|
};
|
|
99
|
-
|
|
100
|
-
n.
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
let b = n.decodeFont;
|
|
100
|
+
n.decodeFont = function(d, e) {
|
|
101
|
+
d = b(d);
|
|
102
|
+
e(d);
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
const c = n.FileAssetLoader;
|
|
105
|
+
n.ptrToAsset = d => {
|
|
106
|
+
let e = n.ptrToFileAsset(d);
|
|
107
|
+
return e.isImage ? n.ptrToImageAsset(d) : e.isFont ? n.ptrToFontAsset(d) : e.isAudio ? n.ptrToAudioAsset(d) : e;
|
|
108
|
+
};
|
|
109
|
+
n.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:d}) {
|
|
105
110
|
this.__parent.__construct.call(this);
|
|
106
|
-
this.Ab =
|
|
107
|
-
}, loadContents:function(
|
|
108
|
-
|
|
109
|
-
return this.Ab(
|
|
111
|
+
this.Ab = d;
|
|
112
|
+
}, loadContents:function(d, e) {
|
|
113
|
+
d = n.ptrToAsset(d);
|
|
114
|
+
return this.Ab(d, e);
|
|
110
115
|
},});
|
|
111
|
-
n.CDNFileAssetLoader =
|
|
116
|
+
n.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
|
|
112
117
|
this.__parent.__construct.call(this);
|
|
113
|
-
}, loadContents:function(
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
if ("" ===
|
|
118
|
+
}, loadContents:function(d) {
|
|
119
|
+
let e = n.ptrToAsset(d);
|
|
120
|
+
d = e.cdnUuid;
|
|
121
|
+
if ("" === d) {
|
|
117
122
|
return !1;
|
|
118
123
|
}
|
|
119
|
-
(function(
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
4 ==
|
|
124
|
+
(function(f, g) {
|
|
125
|
+
var m = new XMLHttpRequest();
|
|
126
|
+
m.responseType = "arraybuffer";
|
|
127
|
+
m.onreadystatechange = function() {
|
|
128
|
+
4 == m.readyState && 200 == m.status && g(m);
|
|
124
129
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})(
|
|
128
|
-
|
|
130
|
+
m.open("GET", f, !0);
|
|
131
|
+
m.send(null);
|
|
132
|
+
})(e.cdnBaseUrl + "/" + d, f => {
|
|
133
|
+
e.decode(new Uint8Array(f.response));
|
|
129
134
|
});
|
|
130
135
|
return !0;
|
|
131
136
|
},});
|
|
132
|
-
n.FallbackFileAssetLoader =
|
|
137
|
+
n.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
|
|
133
138
|
this.__parent.__construct.call(this);
|
|
134
139
|
this.fb = [];
|
|
135
|
-
}, addLoader:function(
|
|
136
|
-
this.fb.push(
|
|
137
|
-
}, loadContents:function(
|
|
138
|
-
for (let
|
|
139
|
-
if (
|
|
140
|
+
}, addLoader:function(d) {
|
|
141
|
+
this.fb.push(d);
|
|
142
|
+
}, loadContents:function(d, e) {
|
|
143
|
+
for (let f of this.fb) {
|
|
144
|
+
if (f.loadContents(d, e)) {
|
|
140
145
|
return !0;
|
|
141
146
|
}
|
|
142
147
|
}
|
|
@@ -410,7 +415,7 @@ function Pa(a, b) {
|
|
|
410
415
|
return Oa(c, a, b);
|
|
411
416
|
}));
|
|
412
417
|
}
|
|
413
|
-
var J, K, Ta = {
|
|
418
|
+
var J, K, Ta = {474256:(a, b, c, d, e) => {
|
|
414
419
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
415
420
|
return 0;
|
|
416
421
|
}
|
|
@@ -473,9 +478,9 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
|
|
|
473
478
|
}
|
|
474
479
|
window.h.Da += 1;
|
|
475
480
|
return 1;
|
|
476
|
-
},
|
|
481
|
+
}, 476434:() => {
|
|
477
482
|
"undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
|
|
478
|
-
},
|
|
483
|
+
}, 476598:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 476702:() => {
|
|
479
484
|
try {
|
|
480
485
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
481
486
|
a.close();
|
|
@@ -483,7 +488,7 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
|
|
|
483
488
|
} catch (c) {
|
|
484
489
|
return 0;
|
|
485
490
|
}
|
|
486
|
-
},
|
|
491
|
+
}, 476873:(a, b, c, d, e, f) => {
|
|
487
492
|
if ("undefined" === typeof window.h) {
|
|
488
493
|
return -1;
|
|
489
494
|
}
|
|
@@ -529,7 +534,7 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
|
|
|
529
534
|
a == window.h.I.Ca && g.Z.connect(g.J.destination);
|
|
530
535
|
g.kb = f;
|
|
531
536
|
return window.h.tc(g);
|
|
532
|
-
},
|
|
537
|
+
}, 479750:a => window.h.wa(a).J.sampleRate, 479823:a => {
|
|
533
538
|
a = window.h.wa(a);
|
|
534
539
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
535
540
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
@@ -537,13 +542,13 @@ var J, K, Ta = {473872:(a, b, c, d, e) => {
|
|
|
537
542
|
a.J.close();
|
|
538
543
|
a.J = void 0;
|
|
539
544
|
a.kb = void 0;
|
|
540
|
-
},
|
|
545
|
+
}, 480223:a => {
|
|
541
546
|
window.h.xb(a);
|
|
542
|
-
},
|
|
547
|
+
}, 480273:a => {
|
|
543
548
|
a = window.h.wa(a);
|
|
544
549
|
a.J.resume();
|
|
545
550
|
a.state = window.h.ha.sb;
|
|
546
|
-
},
|
|
551
|
+
}, 480412:a => {
|
|
547
552
|
a = window.h.wa(a);
|
|
548
553
|
a.J.suspend();
|
|
549
554
|
a.state = window.h.ha.stopped;
|
|
@@ -3548,8 +3553,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = y.dynCall_viijii
|
|
|
3548
3553
|
n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = y.dynCall_iiiiij)(a, b, c, d, e, f, g);
|
|
3549
3554
|
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
3555
|
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 =
|
|
3556
|
+
n.___start_em_js = 471632;
|
|
3557
|
+
n.___stop_em_js = 474256;
|
|
3553
3558
|
var $d;
|
|
3554
3559
|
Ia = function ae() {
|
|
3555
3560
|
$d || be();
|
|
@@ -3609,7 +3614,7 @@ be();
|
|
|
3609
3614
|
/* 2 */
|
|
3610
3615
|
/***/ ((module) => {
|
|
3611
3616
|
|
|
3612
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
3617
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.15.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
3618
|
|
|
3614
3619
|
/***/ }),
|
|
3615
3620
|
/* 3 */
|
|
@@ -3907,6 +3912,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3907
3912
|
/* harmony export */ StateMachineInput: () => (/* binding */ StateMachineInput),
|
|
3908
3913
|
/* harmony export */ StateMachineInputType: () => (/* binding */ StateMachineInputType),
|
|
3909
3914
|
/* harmony export */ Testing: () => (/* binding */ Testing),
|
|
3915
|
+
/* harmony export */ decodeAudio: () => (/* binding */ decodeAudio),
|
|
3910
3916
|
/* harmony export */ decodeFont: () => (/* binding */ decodeFont),
|
|
3911
3917
|
/* harmony export */ decodeImage: () => (/* binding */ decodeImage)
|
|
3912
3918
|
/* harmony export */ });
|
|
@@ -5031,6 +5037,51 @@ var AudioManager = /** @class */ (function (_super) {
|
|
|
5031
5037
|
return AudioManager;
|
|
5032
5038
|
}(EventManager));
|
|
5033
5039
|
var audioManager = new AudioManager();
|
|
5040
|
+
/**
|
|
5041
|
+
* This class takes care of any observers that will be attached to an animation.
|
|
5042
|
+
* It should be treated as a singleton because observers are much more performant
|
|
5043
|
+
* when used for observing multiple elements by a single instance.
|
|
5044
|
+
*/
|
|
5045
|
+
var ObjectObservers = /** @class */ (function () {
|
|
5046
|
+
function ObjectObservers() {
|
|
5047
|
+
var _this = this;
|
|
5048
|
+
this._elementsMap = new Map();
|
|
5049
|
+
/**
|
|
5050
|
+
* Resize observers trigger both when the element changes its size and also when the
|
|
5051
|
+
* element is added or removed from the document.
|
|
5052
|
+
*/
|
|
5053
|
+
this._onObservedEntry = function (entry) {
|
|
5054
|
+
var observed = _this._elementsMap.get(entry.target);
|
|
5055
|
+
if (observed !== null) {
|
|
5056
|
+
observed.onResize(entry.target.clientWidth == 0 || entry.target.clientHeight == 0);
|
|
5057
|
+
}
|
|
5058
|
+
else {
|
|
5059
|
+
_this._resizeObserver.unobserve(entry.target);
|
|
5060
|
+
}
|
|
5061
|
+
};
|
|
5062
|
+
this._onObserved = function (entries) {
|
|
5063
|
+
entries.forEach(_this._onObservedEntry);
|
|
5064
|
+
};
|
|
5065
|
+
this._resizeObserver = new ResizeObserver(this._onObserved);
|
|
5066
|
+
}
|
|
5067
|
+
// Adds an observable element
|
|
5068
|
+
ObjectObservers.prototype.add = function (element, onResize) {
|
|
5069
|
+
var observed = {
|
|
5070
|
+
onResize: onResize,
|
|
5071
|
+
element: element,
|
|
5072
|
+
};
|
|
5073
|
+
this._elementsMap.set(element, observed);
|
|
5074
|
+
this._resizeObserver.observe(element);
|
|
5075
|
+
return observed;
|
|
5076
|
+
};
|
|
5077
|
+
// Removes an observable element
|
|
5078
|
+
ObjectObservers.prototype.remove = function (observed) {
|
|
5079
|
+
this._resizeObserver.unobserve(observed.element);
|
|
5080
|
+
this._elementsMap.delete(observed.element);
|
|
5081
|
+
};
|
|
5082
|
+
return ObjectObservers;
|
|
5083
|
+
}());
|
|
5084
|
+
var observers = new ObjectObservers();
|
|
5034
5085
|
var Rive = /** @class */ (function () {
|
|
5035
5086
|
function Rive(params) {
|
|
5036
5087
|
var _this = this;
|
|
@@ -5055,17 +5106,28 @@ var Rive = /** @class */ (function () {
|
|
|
5055
5106
|
this.enableRiveAssetCDN = true;
|
|
5056
5107
|
// Keep a local value of the set volume to update it asynchronously
|
|
5057
5108
|
this._volume = 1;
|
|
5109
|
+
// Whether the canvas element's size is 0
|
|
5110
|
+
this._hasZeroSize = false;
|
|
5058
5111
|
// Durations to generate a frame for the last second. Used for performance profiling.
|
|
5059
5112
|
this.durations = [];
|
|
5060
5113
|
this.frameTimes = [];
|
|
5061
5114
|
this.frameCount = 0;
|
|
5062
5115
|
this.isTouchScrollEnabled = false;
|
|
5116
|
+
this.onCanvasResize = function (hasZeroSize) {
|
|
5117
|
+
_this._hasZeroSize = hasZeroSize;
|
|
5118
|
+
if (!_this._layout.maxX || !_this._layout.maxY) {
|
|
5119
|
+
_this.resizeToCanvas();
|
|
5120
|
+
}
|
|
5121
|
+
};
|
|
5063
5122
|
/**
|
|
5064
5123
|
* Used be draw to track when a second of active rendering time has passed.
|
|
5065
5124
|
* Used for debugging purposes
|
|
5066
5125
|
*/
|
|
5067
5126
|
this.renderSecondTimer = 0;
|
|
5068
5127
|
this.canvas = params.canvas;
|
|
5128
|
+
if (params.canvas.constructor === HTMLCanvasElement) {
|
|
5129
|
+
this._observed = observers.add(this.canvas, this.onCanvasResize);
|
|
5130
|
+
}
|
|
5069
5131
|
this.src = params.src;
|
|
5070
5132
|
this.buffer = params.buffer;
|
|
5071
5133
|
this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
|
|
@@ -5118,14 +5180,6 @@ var Rive = /** @class */ (function () {
|
|
|
5118
5180
|
this.assetLoader = params.assetLoader;
|
|
5119
5181
|
// Hook up the task queue
|
|
5120
5182
|
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
|
-
}
|
|
5129
5183
|
this.init({
|
|
5130
5184
|
src: this.src,
|
|
5131
5185
|
buffer: this.buffer,
|
|
@@ -5221,6 +5275,24 @@ var Rive = /** @class */ (function () {
|
|
|
5221
5275
|
this.eventCleanup();
|
|
5222
5276
|
}
|
|
5223
5277
|
};
|
|
5278
|
+
/**
|
|
5279
|
+
* If the instance has audio and the system audio is not ready
|
|
5280
|
+
* we hook the instance to the audio manager
|
|
5281
|
+
*/
|
|
5282
|
+
Rive.prototype.initializeAudio = function () {
|
|
5283
|
+
var _this = this;
|
|
5284
|
+
var _a;
|
|
5285
|
+
// Initialize audio if needed
|
|
5286
|
+
if (audioManager.status == SystemAudioStatus.UNAVAILABLE) {
|
|
5287
|
+
if ((_a = this.artboard) === null || _a === void 0 ? void 0 : _a.hasAudio) {
|
|
5288
|
+
audioManager.add({
|
|
5289
|
+
type: EventType.AudioStatusChange,
|
|
5290
|
+
callback: function () { return _this.onSystemAudioChanged(); },
|
|
5291
|
+
});
|
|
5292
|
+
audioManager.establishAudio();
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
};
|
|
5224
5296
|
// Initializes runtime with Rive data and preps for playing
|
|
5225
5297
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
|
|
5226
5298
|
var _a;
|
|
@@ -5250,6 +5322,8 @@ var Rive = /** @class */ (function () {
|
|
|
5250
5322
|
if (this.file) {
|
|
5251
5323
|
// Initialize and draw frame
|
|
5252
5324
|
this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay);
|
|
5325
|
+
// Check for audio
|
|
5326
|
+
this.initializeAudio();
|
|
5253
5327
|
// Everything's set up, emit a load event
|
|
5254
5328
|
this.loaded = true;
|
|
5255
5329
|
this.eventManager.fire({
|
|
@@ -5327,9 +5401,9 @@ var Rive = /** @class */ (function () {
|
|
|
5327
5401
|
* @param time the time at which to render a frame
|
|
5328
5402
|
*/
|
|
5329
5403
|
Rive.prototype.draw = function (time, onSecond) {
|
|
5330
|
-
var before = performance.now();
|
|
5331
5404
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
5332
5405
|
this.frameRequestId = null;
|
|
5406
|
+
var before = performance.now();
|
|
5333
5407
|
// On the first pass, make sure lastTime has a valid value
|
|
5334
5408
|
if (!this.lastRenderTime) {
|
|
5335
5409
|
this.lastRenderTime = time;
|
|
@@ -5408,7 +5482,10 @@ var Rive = /** @class */ (function () {
|
|
|
5408
5482
|
renderer.save();
|
|
5409
5483
|
// Update the renderer alignment if necessary
|
|
5410
5484
|
this.alignRenderer();
|
|
5411
|
-
|
|
5485
|
+
// Do not draw on 0 canvas size
|
|
5486
|
+
if (!this._hasZeroSize) {
|
|
5487
|
+
this.artboard.draw(renderer);
|
|
5488
|
+
}
|
|
5412
5489
|
renderer.restore();
|
|
5413
5490
|
renderer.flush();
|
|
5414
5491
|
// Check for any animations that looped
|
|
@@ -5488,6 +5565,10 @@ var Rive = /** @class */ (function () {
|
|
|
5488
5565
|
this.stopRendering();
|
|
5489
5566
|
// Clean up any artboard, animation or state machine instances.
|
|
5490
5567
|
this.cleanupInstances();
|
|
5568
|
+
// Remove from observer
|
|
5569
|
+
if (this._observed !== null) {
|
|
5570
|
+
observers.remove(this._observed);
|
|
5571
|
+
}
|
|
5491
5572
|
// Delete the rive file
|
|
5492
5573
|
(_a = this.file) === null || _a === void 0 ? void 0 : _a.delete();
|
|
5493
5574
|
this.file = null;
|
|
@@ -6081,10 +6162,23 @@ var Testing = {
|
|
|
6081
6162
|
};
|
|
6082
6163
|
// #endregion
|
|
6083
6164
|
// #region asset loaders
|
|
6165
|
+
/**
|
|
6166
|
+
* Decodes bytes into an audio asset.
|
|
6167
|
+
*
|
|
6168
|
+
* Be sure to call `.unref()` on the audio once it is no longer needed. This
|
|
6169
|
+
* allows the engine to clean it up when it is not used by any more animations.
|
|
6170
|
+
*/
|
|
6171
|
+
var decodeAudio = function (bytes) {
|
|
6172
|
+
return new Promise(function (resolve) {
|
|
6173
|
+
return RuntimeLoader.getInstance(function (rive) {
|
|
6174
|
+
rive.decodeAudio(bytes, resolve);
|
|
6175
|
+
});
|
|
6176
|
+
});
|
|
6177
|
+
};
|
|
6084
6178
|
/**
|
|
6085
6179
|
* Decodes bytes into an image.
|
|
6086
6180
|
*
|
|
6087
|
-
* Be sure to call `.
|
|
6181
|
+
* Be sure to call `.unref()` on the image once it is no longer needed. This
|
|
6088
6182
|
* allows the engine to clean it up when it is not used by any more animations.
|
|
6089
6183
|
*/
|
|
6090
6184
|
var decodeImage = function (bytes) {
|
|
@@ -6097,7 +6191,7 @@ var decodeImage = function (bytes) {
|
|
|
6097
6191
|
/**
|
|
6098
6192
|
* Decodes bytes into a font.
|
|
6099
6193
|
*
|
|
6100
|
-
* Be sure to call `.
|
|
6194
|
+
* Be sure to call `.unref()` on the font once it is no longer needed. This
|
|
6101
6195
|
* allows the engine to clean it up when it is not used by any more animations.
|
|
6102
6196
|
*/
|
|
6103
6197
|
var decodeFont = function (bytes) {
|