@rive-app/canvas-lite 2.15.6 → 2.16.0
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 +48 -1
- package/rive.js +192 -52
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ export declare enum EventType {
|
|
|
123
123
|
export type RiveEventPayload = rc.RiveEvent | rc.OpenUrlEvent;
|
|
124
124
|
export interface Event {
|
|
125
125
|
type: EventType;
|
|
126
|
-
data?: string | string[] | LoopEvent | number | RiveEventPayload;
|
|
126
|
+
data?: string | string[] | LoopEvent | number | RiveEventPayload | RiveFile;
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* Looping types: one-shot, loop, and ping-pong
|
|
@@ -189,6 +189,7 @@ export interface RiveParameters {
|
|
|
189
189
|
canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
190
190
|
src?: string;
|
|
191
191
|
buffer?: ArrayBuffer;
|
|
192
|
+
riveFile?: RiveFile;
|
|
192
193
|
artboard?: string;
|
|
193
194
|
animations?: string | string[];
|
|
194
195
|
stateMachines?: string | string[];
|
|
@@ -265,6 +266,7 @@ export interface RiveParameters {
|
|
|
265
266
|
export interface RiveLoadParameters {
|
|
266
267
|
src?: string;
|
|
267
268
|
buffer?: ArrayBuffer;
|
|
269
|
+
riveFile?: RiveFile;
|
|
268
270
|
autoplay?: boolean;
|
|
269
271
|
artboard?: string;
|
|
270
272
|
animations?: string | string[];
|
|
@@ -278,6 +280,50 @@ export interface RiveResetParameters {
|
|
|
278
280
|
stateMachines?: string | string[];
|
|
279
281
|
autoplay?: boolean;
|
|
280
282
|
}
|
|
283
|
+
export interface RiveFileParameters {
|
|
284
|
+
src?: string;
|
|
285
|
+
buffer?: ArrayBuffer;
|
|
286
|
+
assetLoader?: AssetLoadCallback;
|
|
287
|
+
enableRiveAssetCDN?: boolean;
|
|
288
|
+
onLoad?: EventCallback;
|
|
289
|
+
onLoadError?: EventCallback;
|
|
290
|
+
}
|
|
291
|
+
export declare class RiveFile {
|
|
292
|
+
private static readonly missingErrorMessage;
|
|
293
|
+
private static readonly fileLoadErrorMessage;
|
|
294
|
+
private src;
|
|
295
|
+
private buffer;
|
|
296
|
+
private runtime;
|
|
297
|
+
private file;
|
|
298
|
+
private assetLoader;
|
|
299
|
+
private enableRiveAssetCDN;
|
|
300
|
+
private eventManager;
|
|
301
|
+
private referenceCount;
|
|
302
|
+
constructor(params: RiveFileParameters);
|
|
303
|
+
private initData;
|
|
304
|
+
init(): Promise<void>;
|
|
305
|
+
/**
|
|
306
|
+
* Subscribe to Rive-generated events
|
|
307
|
+
* @param type the type of event to subscribe to
|
|
308
|
+
* @param callback callback to fire when the event occurs
|
|
309
|
+
*/
|
|
310
|
+
on(type: EventType, callback: EventCallback): void;
|
|
311
|
+
/**
|
|
312
|
+
* Unsubscribes from a Rive-generated event
|
|
313
|
+
* @param type the type of event to unsubscribe from
|
|
314
|
+
* @param callback the callback to unsubscribe
|
|
315
|
+
*/
|
|
316
|
+
off(type: EventType, callback: EventCallback): void;
|
|
317
|
+
cleanup(): void;
|
|
318
|
+
/**
|
|
319
|
+
* Unsubscribes all Rive listeners from an event type, or everything if no type is
|
|
320
|
+
* given
|
|
321
|
+
* @param type the type of event to unsubscribe from, or all types if
|
|
322
|
+
* undefined
|
|
323
|
+
*/
|
|
324
|
+
removeAllRiveEventListeners(type?: EventType): void;
|
|
325
|
+
getInstance(): rc.File;
|
|
326
|
+
}
|
|
281
327
|
export declare class Rive {
|
|
282
328
|
private readonly canvas;
|
|
283
329
|
private src;
|
|
@@ -298,6 +344,7 @@ export declare class Rive {
|
|
|
298
344
|
private artboard;
|
|
299
345
|
private eventCleanup;
|
|
300
346
|
private file;
|
|
347
|
+
private riveFile;
|
|
301
348
|
private eventManager;
|
|
302
349
|
private taskQueue;
|
|
303
350
|
private animator;
|
package/rive.js
CHANGED
|
@@ -2030,7 +2030,7 @@ var Mc = {_embind_create_inheriting_constructor:function(b, a, c) {
|
|
|
2030
2030
|
Ib(b, {cb:!0, name:a, argPackAdvance:0, fromWireType:function() {
|
|
2031
2031
|
}, toWireType:function() {
|
|
2032
2032
|
},});
|
|
2033
|
-
}, _emval_as:function(b, a, c) {
|
|
2033
|
+
}, _emscripten_get_now_is_monotonic:() => !0, _emval_as:function(b, a, c) {
|
|
2034
2034
|
b = S(b);
|
|
2035
2035
|
a = nb(a, "emval::as");
|
|
2036
2036
|
var d = [], e = ab(d);
|
|
@@ -2099,7 +2099,9 @@ var Mc = {_embind_create_inheriting_constructor:function(b, a, c) {
|
|
|
2099
2099
|
return ab(b);
|
|
2100
2100
|
}, abort:() => {
|
|
2101
2101
|
ya("");
|
|
2102
|
-
},
|
|
2102
|
+
}, emscripten_date_now:function() {
|
|
2103
|
+
return Date.now();
|
|
2104
|
+
}, emscripten_get_now:() => performance.now(), emscripten_memcpy_big:(b, a, c) => L.copyWithin(b, a, a + c), emscripten_resize_heap:b => {
|
|
2103
2105
|
var a = L.length;
|
|
2104
2106
|
b >>>= 0;
|
|
2105
2107
|
if (2147483648 < b) {
|
|
@@ -2257,7 +2259,7 @@ Pc();
|
|
|
2257
2259
|
/* 2 */
|
|
2258
2260
|
/***/ ((module) => {
|
|
2259
2261
|
|
|
2260
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
2262
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.16.0","description":"A lite version of 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_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
2261
2263
|
|
|
2262
2264
|
/***/ }),
|
|
2263
2265
|
/* 3 */
|
|
@@ -2551,6 +2553,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2551
2553
|
/* harmony export */ LoopType: () => (/* binding */ LoopType),
|
|
2552
2554
|
/* harmony export */ Rive: () => (/* binding */ Rive),
|
|
2553
2555
|
/* harmony export */ RiveEventType: () => (/* binding */ RiveEventType),
|
|
2556
|
+
/* harmony export */ RiveFile: () => (/* binding */ RiveFile),
|
|
2554
2557
|
/* harmony export */ RuntimeLoader: () => (/* binding */ RuntimeLoader),
|
|
2555
2558
|
/* harmony export */ StateMachineInput: () => (/* binding */ StateMachineInput),
|
|
2556
2559
|
/* harmony export */ StateMachineInputType: () => (/* binding */ StateMachineInputType),
|
|
@@ -3736,6 +3739,142 @@ var ObjectObservers = /** @class */ (function () {
|
|
|
3736
3739
|
return ObjectObservers;
|
|
3737
3740
|
}());
|
|
3738
3741
|
var observers = new ObjectObservers();
|
|
3742
|
+
var RiveFile = /** @class */ (function () {
|
|
3743
|
+
function RiveFile(params) {
|
|
3744
|
+
// Allow the runtime to automatically load assets hosted in Rive's runtime.
|
|
3745
|
+
this.enableRiveAssetCDN = true;
|
|
3746
|
+
this.referenceCount = 0;
|
|
3747
|
+
this.src = params.src;
|
|
3748
|
+
this.buffer = params.buffer;
|
|
3749
|
+
if (params.assetLoader)
|
|
3750
|
+
this.assetLoader = params.assetLoader;
|
|
3751
|
+
this.enableRiveAssetCDN =
|
|
3752
|
+
typeof params.enableRiveAssetCDN == "boolean"
|
|
3753
|
+
? params.enableRiveAssetCDN
|
|
3754
|
+
: true;
|
|
3755
|
+
// New event management system
|
|
3756
|
+
this.eventManager = new EventManager();
|
|
3757
|
+
if (params.onLoad)
|
|
3758
|
+
this.on(EventType.Load, params.onLoad);
|
|
3759
|
+
if (params.onLoadError)
|
|
3760
|
+
this.on(EventType.LoadError, params.onLoadError);
|
|
3761
|
+
}
|
|
3762
|
+
RiveFile.prototype.initData = function () {
|
|
3763
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3764
|
+
var _a, loader, _b;
|
|
3765
|
+
return __generator(this, function (_c) {
|
|
3766
|
+
switch (_c.label) {
|
|
3767
|
+
case 0:
|
|
3768
|
+
if (!this.src) return [3 /*break*/, 2];
|
|
3769
|
+
_a = this;
|
|
3770
|
+
return [4 /*yield*/, loadRiveFile(this.src)];
|
|
3771
|
+
case 1:
|
|
3772
|
+
_a.buffer = _c.sent();
|
|
3773
|
+
_c.label = 2;
|
|
3774
|
+
case 2:
|
|
3775
|
+
if (this.assetLoader) {
|
|
3776
|
+
loader = new this.runtime.CustomFileAssetLoader({
|
|
3777
|
+
loadContents: this.assetLoader,
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3780
|
+
// Load the Rive file
|
|
3781
|
+
_b = this;
|
|
3782
|
+
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
|
|
3783
|
+
case 3:
|
|
3784
|
+
// Load the Rive file
|
|
3785
|
+
_b.file = _c.sent();
|
|
3786
|
+
if (this.file !== null) {
|
|
3787
|
+
this.eventManager.fire({
|
|
3788
|
+
type: EventType.Load,
|
|
3789
|
+
data: this,
|
|
3790
|
+
});
|
|
3791
|
+
}
|
|
3792
|
+
else {
|
|
3793
|
+
this.eventManager.fire({
|
|
3794
|
+
type: EventType.LoadError,
|
|
3795
|
+
data: null,
|
|
3796
|
+
});
|
|
3797
|
+
throw new Error(RiveFile.fileLoadErrorMessage);
|
|
3798
|
+
}
|
|
3799
|
+
return [2 /*return*/];
|
|
3800
|
+
}
|
|
3801
|
+
});
|
|
3802
|
+
});
|
|
3803
|
+
};
|
|
3804
|
+
RiveFile.prototype.init = function () {
|
|
3805
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3806
|
+
var _a;
|
|
3807
|
+
return __generator(this, function (_b) {
|
|
3808
|
+
switch (_b.label) {
|
|
3809
|
+
case 0:
|
|
3810
|
+
// If no source file url specified, it's a bust
|
|
3811
|
+
if (!this.src && !this.buffer) {
|
|
3812
|
+
throw new Error(RiveFile.missingErrorMessage);
|
|
3813
|
+
}
|
|
3814
|
+
_a = this;
|
|
3815
|
+
return [4 /*yield*/, RuntimeLoader.awaitInstance()];
|
|
3816
|
+
case 1:
|
|
3817
|
+
_a.runtime = _b.sent();
|
|
3818
|
+
return [4 /*yield*/, this.initData()];
|
|
3819
|
+
case 2:
|
|
3820
|
+
_b.sent();
|
|
3821
|
+
return [2 /*return*/];
|
|
3822
|
+
}
|
|
3823
|
+
});
|
|
3824
|
+
});
|
|
3825
|
+
};
|
|
3826
|
+
/**
|
|
3827
|
+
* Subscribe to Rive-generated events
|
|
3828
|
+
* @param type the type of event to subscribe to
|
|
3829
|
+
* @param callback callback to fire when the event occurs
|
|
3830
|
+
*/
|
|
3831
|
+
RiveFile.prototype.on = function (type, callback) {
|
|
3832
|
+
this.eventManager.add({
|
|
3833
|
+
type: type,
|
|
3834
|
+
callback: callback,
|
|
3835
|
+
});
|
|
3836
|
+
};
|
|
3837
|
+
/**
|
|
3838
|
+
* Unsubscribes from a Rive-generated event
|
|
3839
|
+
* @param type the type of event to unsubscribe from
|
|
3840
|
+
* @param callback the callback to unsubscribe
|
|
3841
|
+
*/
|
|
3842
|
+
RiveFile.prototype.off = function (type, callback) {
|
|
3843
|
+
this.eventManager.remove({
|
|
3844
|
+
type: type,
|
|
3845
|
+
callback: callback,
|
|
3846
|
+
});
|
|
3847
|
+
};
|
|
3848
|
+
RiveFile.prototype.cleanup = function () {
|
|
3849
|
+
var _a;
|
|
3850
|
+
this.referenceCount -= 1;
|
|
3851
|
+
if (this.referenceCount <= 0) {
|
|
3852
|
+
this.removeAllRiveEventListeners();
|
|
3853
|
+
(_a = this.file) === null || _a === void 0 ? void 0 : _a.delete();
|
|
3854
|
+
}
|
|
3855
|
+
};
|
|
3856
|
+
/**
|
|
3857
|
+
* Unsubscribes all Rive listeners from an event type, or everything if no type is
|
|
3858
|
+
* given
|
|
3859
|
+
* @param type the type of event to unsubscribe from, or all types if
|
|
3860
|
+
* undefined
|
|
3861
|
+
*/
|
|
3862
|
+
RiveFile.prototype.removeAllRiveEventListeners = function (type) {
|
|
3863
|
+
this.eventManager.removeAll(type);
|
|
3864
|
+
};
|
|
3865
|
+
RiveFile.prototype.getInstance = function () {
|
|
3866
|
+
if (this.file !== null) {
|
|
3867
|
+
this.referenceCount += 1;
|
|
3868
|
+
return this.file;
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
// Error message for missing source or buffer
|
|
3872
|
+
RiveFile.missingErrorMessage = "Rive source file or data buffer required";
|
|
3873
|
+
// Error message for file load error
|
|
3874
|
+
RiveFile.fileLoadErrorMessage = "The file failed to load";
|
|
3875
|
+
return RiveFile;
|
|
3876
|
+
}());
|
|
3877
|
+
|
|
3739
3878
|
var Rive = /** @class */ (function () {
|
|
3740
3879
|
function Rive(params) {
|
|
3741
3880
|
var _this = this;
|
|
@@ -3784,6 +3923,7 @@ var Rive = /** @class */ (function () {
|
|
|
3784
3923
|
}
|
|
3785
3924
|
this.src = params.src;
|
|
3786
3925
|
this.buffer = params.buffer;
|
|
3926
|
+
this.riveFile = params.riveFile;
|
|
3787
3927
|
this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
|
|
3788
3928
|
this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
|
|
3789
3929
|
this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
|
|
@@ -3837,6 +3977,7 @@ var Rive = /** @class */ (function () {
|
|
|
3837
3977
|
this.init({
|
|
3838
3978
|
src: this.src,
|
|
3839
3979
|
buffer: this.buffer,
|
|
3980
|
+
riveFile: this.riveFile,
|
|
3840
3981
|
autoplay: params.autoplay,
|
|
3841
3982
|
animations: params.animations,
|
|
3842
3983
|
stateMachines: params.stateMachines,
|
|
@@ -3856,11 +3997,12 @@ var Rive = /** @class */ (function () {
|
|
|
3856
3997
|
// Initializes the Rive object either from constructor or load()
|
|
3857
3998
|
Rive.prototype.init = function (_a) {
|
|
3858
3999
|
var _this = this;
|
|
3859
|
-
var src = _a.src, buffer = _a.buffer, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c;
|
|
4000
|
+
var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c;
|
|
3860
4001
|
this.src = src;
|
|
3861
4002
|
this.buffer = buffer;
|
|
4003
|
+
this.riveFile = riveFile;
|
|
3862
4004
|
// If no source file url specified, it's a bust
|
|
3863
|
-
if (!this.src && !this.buffer) {
|
|
4005
|
+
if (!this.src && !this.buffer && !this.riveFile) {
|
|
3864
4006
|
throw new Error(Rive.missingErrorMessage);
|
|
3865
4007
|
}
|
|
3866
4008
|
// List of animations that should be initialized.
|
|
@@ -3951,59 +4093,56 @@ var Rive = /** @class */ (function () {
|
|
|
3951
4093
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
|
|
3952
4094
|
var _a;
|
|
3953
4095
|
return __awaiter(this, void 0, void 0, function () {
|
|
3954
|
-
var
|
|
3955
|
-
return __generator(this, function (
|
|
3956
|
-
switch (
|
|
4096
|
+
var error_1, msg;
|
|
4097
|
+
return __generator(this, function (_b) {
|
|
4098
|
+
switch (_b.label) {
|
|
3957
4099
|
case 0:
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
4100
|
+
_b.trys.push([0, 3, , 4]);
|
|
4101
|
+
if (!(this.riveFile == null)) return [3 /*break*/, 2];
|
|
4102
|
+
this.riveFile = new RiveFile({
|
|
4103
|
+
src: this.src,
|
|
4104
|
+
buffer: this.buffer,
|
|
4105
|
+
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
4106
|
+
assetLoader: this.assetLoader,
|
|
4107
|
+
});
|
|
4108
|
+
return [4 /*yield*/, this.riveFile.init()];
|
|
3961
4109
|
case 1:
|
|
3962
|
-
_b.
|
|
3963
|
-
|
|
4110
|
+
_b.sent();
|
|
4111
|
+
_b.label = 2;
|
|
3964
4112
|
case 2:
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
//
|
|
3971
|
-
|
|
3972
|
-
|
|
4113
|
+
this.file = this.riveFile.getInstance();
|
|
4114
|
+
// Initialize and draw frame
|
|
4115
|
+
this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay);
|
|
4116
|
+
// Check for audio
|
|
4117
|
+
this.initializeAudio();
|
|
4118
|
+
// Everything's set up, emit a load event
|
|
4119
|
+
this.loaded = true;
|
|
4120
|
+
this.eventManager.fire({
|
|
4121
|
+
type: EventType.Load,
|
|
4122
|
+
data: (_a = this.src) !== null && _a !== void 0 ? _a : "buffer",
|
|
4123
|
+
});
|
|
4124
|
+
// Flag ready for playback commands and clear the task queue; this order
|
|
4125
|
+
// is important or it may infinitely recurse
|
|
4126
|
+
this.readyForPlaying = true;
|
|
4127
|
+
this.taskQueue.process();
|
|
4128
|
+
this.drawFrame();
|
|
4129
|
+
return [2 /*return*/, Promise.resolve()];
|
|
3973
4130
|
case 3:
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
this.initializeAudio();
|
|
3981
|
-
// Everything's set up, emit a load event
|
|
3982
|
-
this.loaded = true;
|
|
3983
|
-
this.eventManager.fire({
|
|
3984
|
-
type: EventType.Load,
|
|
3985
|
-
data: (_a = this.src) !== null && _a !== void 0 ? _a : "buffer",
|
|
3986
|
-
});
|
|
3987
|
-
// Flag ready for playback commands and clear the task queue; this order
|
|
3988
|
-
// is important or it may infinitely recurse
|
|
3989
|
-
this.readyForPlaying = true;
|
|
3990
|
-
this.taskQueue.process();
|
|
3991
|
-
this.drawFrame();
|
|
3992
|
-
return [2 /*return*/, Promise.resolve()];
|
|
3993
|
-
}
|
|
3994
|
-
else {
|
|
3995
|
-
msg = "Problem loading file; may be corrupt!";
|
|
3996
|
-
console.warn(msg);
|
|
3997
|
-
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
3998
|
-
return [2 /*return*/, Promise.reject(msg)];
|
|
3999
|
-
}
|
|
4000
|
-
return [2 /*return*/];
|
|
4131
|
+
error_1 = _b.sent();
|
|
4132
|
+
msg = "Problem loading file; may be corrupt!";
|
|
4133
|
+
console.warn(msg);
|
|
4134
|
+
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
4135
|
+
return [2 /*return*/, Promise.reject(msg)];
|
|
4136
|
+
case 4: return [2 /*return*/];
|
|
4001
4137
|
}
|
|
4002
4138
|
});
|
|
4003
4139
|
});
|
|
4004
4140
|
};
|
|
4005
4141
|
// Initialize for playback
|
|
4006
4142
|
Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay) {
|
|
4143
|
+
if (!this.file) {
|
|
4144
|
+
return;
|
|
4145
|
+
}
|
|
4007
4146
|
// Fetch the artboard
|
|
4008
4147
|
var rootArtboard = artboardName
|
|
4009
4148
|
? this.file.artboardByName(artboardName)
|
|
@@ -4223,8 +4362,8 @@ var Rive = /** @class */ (function () {
|
|
|
4223
4362
|
if (this._observed !== null) {
|
|
4224
4363
|
observers.remove(this._observed);
|
|
4225
4364
|
}
|
|
4226
|
-
|
|
4227
|
-
|
|
4365
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
4366
|
+
this.riveFile = null;
|
|
4228
4367
|
this.file = null;
|
|
4229
4368
|
};
|
|
4230
4369
|
/**
|
|
@@ -4388,6 +4527,7 @@ var Rive = /** @class */ (function () {
|
|
|
4388
4527
|
};
|
|
4389
4528
|
// Loads a new Rive file, keeping listeners in place
|
|
4390
4529
|
Rive.prototype.load = function (params) {
|
|
4530
|
+
this.file = null;
|
|
4391
4531
|
// Stop all animations
|
|
4392
4532
|
this.stop();
|
|
4393
4533
|
// Reinitialize
|
|
@@ -4466,7 +4606,7 @@ var Rive = /** @class */ (function () {
|
|
|
4466
4606
|
// Returns a list of animation names on the chosen artboard
|
|
4467
4607
|
get: function () {
|
|
4468
4608
|
// If the file's not loaded, we got nothing to return
|
|
4469
|
-
if (!this.loaded) {
|
|
4609
|
+
if (!this.loaded || !this.artboard) {
|
|
4470
4610
|
return [];
|
|
4471
4611
|
}
|
|
4472
4612
|
var animationNames = [];
|
|
@@ -4484,7 +4624,7 @@ var Rive = /** @class */ (function () {
|
|
|
4484
4624
|
*/
|
|
4485
4625
|
get: function () {
|
|
4486
4626
|
// If the file's not loaded, we got nothing to return
|
|
4487
|
-
if (!this.loaded) {
|
|
4627
|
+
if (!this.loaded || !this.artboard) {
|
|
4488
4628
|
return [];
|
|
4489
4629
|
}
|
|
4490
4630
|
var stateMachineNames = [];
|