@rive-app/webgl-single 1.0.91 → 1.0.92
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 +9 -8
- package/rive.js +15 -19
- package/rive.js.map +1 -1
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ import * as rc from "./rive_advanced.mjs";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare type VoidCallback = () => void;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Type for artboard bounds
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
10
|
-
}
|
|
9
|
+
export declare type Bounds = rc.AABB;
|
|
11
10
|
export declare enum Fit {
|
|
12
11
|
Cover = "cover",
|
|
13
12
|
Contain = "contain",
|
|
@@ -163,7 +162,7 @@ declare class EventManager {
|
|
|
163
162
|
fire(event: Event): void;
|
|
164
163
|
}
|
|
165
164
|
export interface Task {
|
|
166
|
-
action
|
|
165
|
+
action?: VoidCallback;
|
|
167
166
|
event?: Event;
|
|
168
167
|
}
|
|
169
168
|
declare class TaskQueueManager {
|
|
@@ -274,7 +273,8 @@ export declare class Rive {
|
|
|
274
273
|
private lastRenderTime;
|
|
275
274
|
private frameRequestId;
|
|
276
275
|
/**
|
|
277
|
-
* Used be draw to track when a second of active rendering time has passed.
|
|
276
|
+
* Used be draw to track when a second of active rendering time has passed.
|
|
277
|
+
* Used for debugging purposes
|
|
278
278
|
*/
|
|
279
279
|
private renderSecondTimer;
|
|
280
280
|
/**
|
|
@@ -334,8 +334,8 @@ export declare class Rive {
|
|
|
334
334
|
/**
|
|
335
335
|
* Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.
|
|
336
336
|
* Uses the size of the backing canvas to set new width/height attributes. Need to re-render
|
|
337
|
-
* and resize the layout to match the new drawing surface afterwards.
|
|
338
|
-
* to include in a window resize listener
|
|
337
|
+
* and resize the layout to match the new drawing surface afterwards.
|
|
338
|
+
* Useful function for consumers to include in a window resize listener
|
|
339
339
|
*/
|
|
340
340
|
resizeDrawingSurfaceToCanvas(): void;
|
|
341
341
|
get source(): string;
|
|
@@ -415,7 +415,8 @@ export declare class Rive {
|
|
|
415
415
|
startRendering(): void;
|
|
416
416
|
/**
|
|
417
417
|
* Enables frames-per-second (FPS) reporting for the runtime
|
|
418
|
-
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
|
418
|
+
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
|
419
|
+
* the page with the FPS reading
|
|
419
420
|
* @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value
|
|
420
421
|
*/
|
|
421
422
|
enableFPSCounter(fpsCallback?: FPSCallback): void;
|
package/rive.js
CHANGED
|
@@ -167,7 +167,7 @@ if(h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);0<h.preIn
|
|
|
167
167
|
/* 2 */
|
|
168
168
|
/***/ ((module) => {
|
|
169
169
|
|
|
170
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl-single","version":"1.0.
|
|
170
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl-single","version":"1.0.92","description":"Rive\'s webgl based web api with bundled wasm.","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
171
171
|
|
|
172
172
|
/***/ }),
|
|
173
173
|
/* 3 */
|
|
@@ -395,14 +395,6 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
395
395
|
|
|
396
396
|
|
|
397
397
|
|
|
398
|
-
// Tracks playback states; numbers map to the runtime's numerical values
|
|
399
|
-
// i.e. play: 0, pause: 1, stop: 2
|
|
400
|
-
var PlaybackState;
|
|
401
|
-
(function (PlaybackState) {
|
|
402
|
-
PlaybackState[PlaybackState["Play"] = 0] = "Play";
|
|
403
|
-
PlaybackState[PlaybackState["Pause"] = 1] = "Pause";
|
|
404
|
-
PlaybackState[PlaybackState["Stop"] = 2] = "Stop";
|
|
405
|
-
})(PlaybackState || (PlaybackState = {}));
|
|
406
398
|
// #region layout
|
|
407
399
|
// Fit options for the canvas
|
|
408
400
|
var Fit;
|
|
@@ -520,7 +512,7 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
520
512
|
RuntimeLoader.loadRuntime = function () {
|
|
521
513
|
_rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__.default({
|
|
522
514
|
// Loads Wasm bundle
|
|
523
|
-
locateFile: function (
|
|
515
|
+
locateFile: function () { return RuntimeLoader.wasmURL; },
|
|
524
516
|
}).then(function (rive) {
|
|
525
517
|
var _a;
|
|
526
518
|
RuntimeLoader.runtime = rive;
|
|
@@ -546,7 +538,7 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
546
538
|
};
|
|
547
539
|
// Provides a runtime instance via a promise
|
|
548
540
|
RuntimeLoader.awaitInstance = function () {
|
|
549
|
-
return new Promise(function (resolve
|
|
541
|
+
return new Promise(function (resolve) {
|
|
550
542
|
return RuntimeLoader.getInstance(function (rive) { return resolve(rive); });
|
|
551
543
|
});
|
|
552
544
|
};
|
|
@@ -1184,7 +1176,9 @@ var TaskQueueManager = /** @class */ (function () {
|
|
|
1184
1176
|
TaskQueueManager.prototype.process = function () {
|
|
1185
1177
|
while (this.queue.length > 0) {
|
|
1186
1178
|
var task = this.queue.shift();
|
|
1187
|
-
task === null || task === void 0 ? void 0 : task.action
|
|
1179
|
+
if (task === null || task === void 0 ? void 0 : task.action) {
|
|
1180
|
+
task.action();
|
|
1181
|
+
}
|
|
1188
1182
|
if (task === null || task === void 0 ? void 0 : task.event) {
|
|
1189
1183
|
this.eventManager.fire(task.event);
|
|
1190
1184
|
}
|
|
@@ -1221,7 +1215,8 @@ var Rive = /** @class */ (function () {
|
|
|
1221
1215
|
this.frameTimes = [];
|
|
1222
1216
|
this.frameCount = 0;
|
|
1223
1217
|
/**
|
|
1224
|
-
* Used be draw to track when a second of active rendering time has passed.
|
|
1218
|
+
* Used be draw to track when a second of active rendering time has passed.
|
|
1219
|
+
* Used for debugging purposes
|
|
1225
1220
|
*/
|
|
1226
1221
|
this.renderSecondTimer = 0;
|
|
1227
1222
|
this.canvas = params.canvas;
|
|
@@ -1301,7 +1296,8 @@ var Rive = /** @class */ (function () {
|
|
|
1301
1296
|
_this.runtime = runtime;
|
|
1302
1297
|
// Get the canvas where you want to render the animation and create a renderer
|
|
1303
1298
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
1304
|
-
// Initial size adjustment based on devicePixelRatio if no width/height are
|
|
1299
|
+
// Initial size adjustment based on devicePixelRatio if no width/height are
|
|
1300
|
+
// specified explicitly
|
|
1305
1301
|
if (!(_this.canvas.width || _this.canvas.height)) {
|
|
1306
1302
|
_this.resizeDrawingSurfaceToCanvas();
|
|
1307
1303
|
}
|
|
@@ -1413,7 +1409,6 @@ var Rive = /** @class */ (function () {
|
|
|
1413
1409
|
}
|
|
1414
1410
|
// Queue up firing the playback events
|
|
1415
1411
|
this.taskQueue.add({
|
|
1416
|
-
action: function () { },
|
|
1417
1412
|
event: {
|
|
1418
1413
|
type: autoplay ? EventType.Play : EventType.Pause,
|
|
1419
1414
|
data: instanceNames,
|
|
@@ -1452,7 +1447,7 @@ var Rive = /** @class */ (function () {
|
|
|
1452
1447
|
.filter(function (a) { return a.playing || a.needsScrub; })
|
|
1453
1448
|
// The scrubbed animations must be applied first to prevent weird artifacts
|
|
1454
1449
|
// if the playing animations conflict with the scrubbed animating attribuates.
|
|
1455
|
-
.sort(function (first
|
|
1450
|
+
.sort(function (first) { return (first.needsScrub ? -1 : 1); });
|
|
1456
1451
|
for (var _i = 0, activeAnimations_1 = activeAnimations; _i < activeAnimations_1.length; _i++) {
|
|
1457
1452
|
var animation = activeAnimations_1[_i];
|
|
1458
1453
|
animation.advance(elapsedTime);
|
|
@@ -1699,8 +1694,8 @@ var Rive = /** @class */ (function () {
|
|
|
1699
1694
|
/**
|
|
1700
1695
|
* Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.
|
|
1701
1696
|
* Uses the size of the backing canvas to set new width/height attributes. Need to re-render
|
|
1702
|
-
* and resize the layout to match the new drawing surface afterwards.
|
|
1703
|
-
* to include in a window resize listener
|
|
1697
|
+
* and resize the layout to match the new drawing surface afterwards.
|
|
1698
|
+
* Useful function for consumers to include in a window resize listener
|
|
1704
1699
|
*/
|
|
1705
1700
|
Rive.prototype.resizeDrawingSurfaceToCanvas = function () {
|
|
1706
1701
|
if (this.canvas instanceof HTMLCanvasElement && !!window) {
|
|
@@ -1942,7 +1937,8 @@ var Rive = /** @class */ (function () {
|
|
|
1942
1937
|
};
|
|
1943
1938
|
/**
|
|
1944
1939
|
* Enables frames-per-second (FPS) reporting for the runtime
|
|
1945
|
-
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
|
1940
|
+
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
|
1941
|
+
* the page with the FPS reading
|
|
1946
1942
|
* @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value
|
|
1947
1943
|
*/
|
|
1948
1944
|
Rive.prototype.enableFPSCounter = function (fpsCallback) {
|