@rive-app/webgl-single 1.0.90 → 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 +20 -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 */
|
|
@@ -232,6 +232,11 @@ const registerTouchInteractions = ({
|
|
|
232
232
|
const transformedX = transformedVector.x();
|
|
233
233
|
const transformedY = transformedVector.y();
|
|
234
234
|
|
|
235
|
+
transformedVector.delete();
|
|
236
|
+
invertedMatrix.delete();
|
|
237
|
+
canvasCoordinatesVector.delete();
|
|
238
|
+
forwardMatrix.delete();
|
|
239
|
+
|
|
235
240
|
switch (event.type) {
|
|
236
241
|
// Pointer moving/hovering on the canvas
|
|
237
242
|
case "mouseover":
|
|
@@ -390,14 +395,6 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
390
395
|
|
|
391
396
|
|
|
392
397
|
|
|
393
|
-
// Tracks playback states; numbers map to the runtime's numerical values
|
|
394
|
-
// i.e. play: 0, pause: 1, stop: 2
|
|
395
|
-
var PlaybackState;
|
|
396
|
-
(function (PlaybackState) {
|
|
397
|
-
PlaybackState[PlaybackState["Play"] = 0] = "Play";
|
|
398
|
-
PlaybackState[PlaybackState["Pause"] = 1] = "Pause";
|
|
399
|
-
PlaybackState[PlaybackState["Stop"] = 2] = "Stop";
|
|
400
|
-
})(PlaybackState || (PlaybackState = {}));
|
|
401
398
|
// #region layout
|
|
402
399
|
// Fit options for the canvas
|
|
403
400
|
var Fit;
|
|
@@ -515,7 +512,7 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
515
512
|
RuntimeLoader.loadRuntime = function () {
|
|
516
513
|
_rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__.default({
|
|
517
514
|
// Loads Wasm bundle
|
|
518
|
-
locateFile: function (
|
|
515
|
+
locateFile: function () { return RuntimeLoader.wasmURL; },
|
|
519
516
|
}).then(function (rive) {
|
|
520
517
|
var _a;
|
|
521
518
|
RuntimeLoader.runtime = rive;
|
|
@@ -541,7 +538,7 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
541
538
|
};
|
|
542
539
|
// Provides a runtime instance via a promise
|
|
543
540
|
RuntimeLoader.awaitInstance = function () {
|
|
544
|
-
return new Promise(function (resolve
|
|
541
|
+
return new Promise(function (resolve) {
|
|
545
542
|
return RuntimeLoader.getInstance(function (rive) { return resolve(rive); });
|
|
546
543
|
});
|
|
547
544
|
};
|
|
@@ -1179,7 +1176,9 @@ var TaskQueueManager = /** @class */ (function () {
|
|
|
1179
1176
|
TaskQueueManager.prototype.process = function () {
|
|
1180
1177
|
while (this.queue.length > 0) {
|
|
1181
1178
|
var task = this.queue.shift();
|
|
1182
|
-
task === null || task === void 0 ? void 0 : task.action
|
|
1179
|
+
if (task === null || task === void 0 ? void 0 : task.action) {
|
|
1180
|
+
task.action();
|
|
1181
|
+
}
|
|
1183
1182
|
if (task === null || task === void 0 ? void 0 : task.event) {
|
|
1184
1183
|
this.eventManager.fire(task.event);
|
|
1185
1184
|
}
|
|
@@ -1216,7 +1215,8 @@ var Rive = /** @class */ (function () {
|
|
|
1216
1215
|
this.frameTimes = [];
|
|
1217
1216
|
this.frameCount = 0;
|
|
1218
1217
|
/**
|
|
1219
|
-
* 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
|
|
1220
1220
|
*/
|
|
1221
1221
|
this.renderSecondTimer = 0;
|
|
1222
1222
|
this.canvas = params.canvas;
|
|
@@ -1296,7 +1296,8 @@ var Rive = /** @class */ (function () {
|
|
|
1296
1296
|
_this.runtime = runtime;
|
|
1297
1297
|
// Get the canvas where you want to render the animation and create a renderer
|
|
1298
1298
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
1299
|
-
// 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
|
|
1300
1301
|
if (!(_this.canvas.width || _this.canvas.height)) {
|
|
1301
1302
|
_this.resizeDrawingSurfaceToCanvas();
|
|
1302
1303
|
}
|
|
@@ -1408,7 +1409,6 @@ var Rive = /** @class */ (function () {
|
|
|
1408
1409
|
}
|
|
1409
1410
|
// Queue up firing the playback events
|
|
1410
1411
|
this.taskQueue.add({
|
|
1411
|
-
action: function () { },
|
|
1412
1412
|
event: {
|
|
1413
1413
|
type: autoplay ? EventType.Play : EventType.Pause,
|
|
1414
1414
|
data: instanceNames,
|
|
@@ -1447,7 +1447,7 @@ var Rive = /** @class */ (function () {
|
|
|
1447
1447
|
.filter(function (a) { return a.playing || a.needsScrub; })
|
|
1448
1448
|
// The scrubbed animations must be applied first to prevent weird artifacts
|
|
1449
1449
|
// if the playing animations conflict with the scrubbed animating attribuates.
|
|
1450
|
-
.sort(function (first
|
|
1450
|
+
.sort(function (first) { return (first.needsScrub ? -1 : 1); });
|
|
1451
1451
|
for (var _i = 0, activeAnimations_1 = activeAnimations; _i < activeAnimations_1.length; _i++) {
|
|
1452
1452
|
var animation = activeAnimations_1[_i];
|
|
1453
1453
|
animation.advance(elapsedTime);
|
|
@@ -1694,8 +1694,8 @@ var Rive = /** @class */ (function () {
|
|
|
1694
1694
|
/**
|
|
1695
1695
|
* Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.
|
|
1696
1696
|
* Uses the size of the backing canvas to set new width/height attributes. Need to re-render
|
|
1697
|
-
* and resize the layout to match the new drawing surface afterwards.
|
|
1698
|
-
* 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
|
|
1699
1699
|
*/
|
|
1700
1700
|
Rive.prototype.resizeDrawingSurfaceToCanvas = function () {
|
|
1701
1701
|
if (this.canvas instanceof HTMLCanvasElement && !!window) {
|
|
@@ -1937,7 +1937,8 @@ var Rive = /** @class */ (function () {
|
|
|
1937
1937
|
};
|
|
1938
1938
|
/**
|
|
1939
1939
|
* Enables frames-per-second (FPS) reporting for the runtime
|
|
1940
|
-
* 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
|
|
1941
1942
|
* @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value
|
|
1942
1943
|
*/
|
|
1943
1944
|
Rive.prototype.enableFPSCounter = function (fpsCallback) {
|