@rive-app/canvas-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
|
@@ -134,7 +134,7 @@ if(m.preInit)for("function"==typeof m.preInit&&(m.preInit=[m.preInit]);0<m.preIn
|
|
|
134
134
|
/* 2 */
|
|
135
135
|
/***/ ((module) => {
|
|
136
136
|
|
|
137
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"1.0.
|
|
137
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"1.0.92","description":"Rive\'s high-level canvas based web api all in one js file.","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}}');
|
|
138
138
|
|
|
139
139
|
/***/ }),
|
|
140
140
|
/* 3 */
|
|
@@ -199,6 +199,11 @@ const registerTouchInteractions = ({
|
|
|
199
199
|
const transformedX = transformedVector.x();
|
|
200
200
|
const transformedY = transformedVector.y();
|
|
201
201
|
|
|
202
|
+
transformedVector.delete();
|
|
203
|
+
invertedMatrix.delete();
|
|
204
|
+
canvasCoordinatesVector.delete();
|
|
205
|
+
forwardMatrix.delete();
|
|
206
|
+
|
|
202
207
|
switch (event.type) {
|
|
203
208
|
// Pointer moving/hovering on the canvas
|
|
204
209
|
case "mouseover":
|
|
@@ -357,14 +362,6 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
357
362
|
|
|
358
363
|
|
|
359
364
|
|
|
360
|
-
// Tracks playback states; numbers map to the runtime's numerical values
|
|
361
|
-
// i.e. play: 0, pause: 1, stop: 2
|
|
362
|
-
var PlaybackState;
|
|
363
|
-
(function (PlaybackState) {
|
|
364
|
-
PlaybackState[PlaybackState["Play"] = 0] = "Play";
|
|
365
|
-
PlaybackState[PlaybackState["Pause"] = 1] = "Pause";
|
|
366
|
-
PlaybackState[PlaybackState["Stop"] = 2] = "Stop";
|
|
367
|
-
})(PlaybackState || (PlaybackState = {}));
|
|
368
365
|
// #region layout
|
|
369
366
|
// Fit options for the canvas
|
|
370
367
|
var Fit;
|
|
@@ -482,7 +479,7 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
482
479
|
RuntimeLoader.loadRuntime = function () {
|
|
483
480
|
_rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__.default({
|
|
484
481
|
// Loads Wasm bundle
|
|
485
|
-
locateFile: function (
|
|
482
|
+
locateFile: function () { return RuntimeLoader.wasmURL; },
|
|
486
483
|
}).then(function (rive) {
|
|
487
484
|
var _a;
|
|
488
485
|
RuntimeLoader.runtime = rive;
|
|
@@ -508,7 +505,7 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
508
505
|
};
|
|
509
506
|
// Provides a runtime instance via a promise
|
|
510
507
|
RuntimeLoader.awaitInstance = function () {
|
|
511
|
-
return new Promise(function (resolve
|
|
508
|
+
return new Promise(function (resolve) {
|
|
512
509
|
return RuntimeLoader.getInstance(function (rive) { return resolve(rive); });
|
|
513
510
|
});
|
|
514
511
|
};
|
|
@@ -1146,7 +1143,9 @@ var TaskQueueManager = /** @class */ (function () {
|
|
|
1146
1143
|
TaskQueueManager.prototype.process = function () {
|
|
1147
1144
|
while (this.queue.length > 0) {
|
|
1148
1145
|
var task = this.queue.shift();
|
|
1149
|
-
task === null || task === void 0 ? void 0 : task.action
|
|
1146
|
+
if (task === null || task === void 0 ? void 0 : task.action) {
|
|
1147
|
+
task.action();
|
|
1148
|
+
}
|
|
1150
1149
|
if (task === null || task === void 0 ? void 0 : task.event) {
|
|
1151
1150
|
this.eventManager.fire(task.event);
|
|
1152
1151
|
}
|
|
@@ -1183,7 +1182,8 @@ var Rive = /** @class */ (function () {
|
|
|
1183
1182
|
this.frameTimes = [];
|
|
1184
1183
|
this.frameCount = 0;
|
|
1185
1184
|
/**
|
|
1186
|
-
* Used be draw to track when a second of active rendering time has passed.
|
|
1185
|
+
* Used be draw to track when a second of active rendering time has passed.
|
|
1186
|
+
* Used for debugging purposes
|
|
1187
1187
|
*/
|
|
1188
1188
|
this.renderSecondTimer = 0;
|
|
1189
1189
|
this.canvas = params.canvas;
|
|
@@ -1263,7 +1263,8 @@ var Rive = /** @class */ (function () {
|
|
|
1263
1263
|
_this.runtime = runtime;
|
|
1264
1264
|
// Get the canvas where you want to render the animation and create a renderer
|
|
1265
1265
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
1266
|
-
// Initial size adjustment based on devicePixelRatio if no width/height are
|
|
1266
|
+
// Initial size adjustment based on devicePixelRatio if no width/height are
|
|
1267
|
+
// specified explicitly
|
|
1267
1268
|
if (!(_this.canvas.width || _this.canvas.height)) {
|
|
1268
1269
|
_this.resizeDrawingSurfaceToCanvas();
|
|
1269
1270
|
}
|
|
@@ -1375,7 +1376,6 @@ var Rive = /** @class */ (function () {
|
|
|
1375
1376
|
}
|
|
1376
1377
|
// Queue up firing the playback events
|
|
1377
1378
|
this.taskQueue.add({
|
|
1378
|
-
action: function () { },
|
|
1379
1379
|
event: {
|
|
1380
1380
|
type: autoplay ? EventType.Play : EventType.Pause,
|
|
1381
1381
|
data: instanceNames,
|
|
@@ -1414,7 +1414,7 @@ var Rive = /** @class */ (function () {
|
|
|
1414
1414
|
.filter(function (a) { return a.playing || a.needsScrub; })
|
|
1415
1415
|
// The scrubbed animations must be applied first to prevent weird artifacts
|
|
1416
1416
|
// if the playing animations conflict with the scrubbed animating attribuates.
|
|
1417
|
-
.sort(function (first
|
|
1417
|
+
.sort(function (first) { return (first.needsScrub ? -1 : 1); });
|
|
1418
1418
|
for (var _i = 0, activeAnimations_1 = activeAnimations; _i < activeAnimations_1.length; _i++) {
|
|
1419
1419
|
var animation = activeAnimations_1[_i];
|
|
1420
1420
|
animation.advance(elapsedTime);
|
|
@@ -1661,8 +1661,8 @@ var Rive = /** @class */ (function () {
|
|
|
1661
1661
|
/**
|
|
1662
1662
|
* Accounts for devicePixelRatio as a multiplier to render the size of the canvas drawing surface.
|
|
1663
1663
|
* Uses the size of the backing canvas to set new width/height attributes. Need to re-render
|
|
1664
|
-
* and resize the layout to match the new drawing surface afterwards.
|
|
1665
|
-
* to include in a window resize listener
|
|
1664
|
+
* and resize the layout to match the new drawing surface afterwards.
|
|
1665
|
+
* Useful function for consumers to include in a window resize listener
|
|
1666
1666
|
*/
|
|
1667
1667
|
Rive.prototype.resizeDrawingSurfaceToCanvas = function () {
|
|
1668
1668
|
if (this.canvas instanceof HTMLCanvasElement && !!window) {
|
|
@@ -1904,7 +1904,8 @@ var Rive = /** @class */ (function () {
|
|
|
1904
1904
|
};
|
|
1905
1905
|
/**
|
|
1906
1906
|
* Enables frames-per-second (FPS) reporting for the runtime
|
|
1907
|
-
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
|
1907
|
+
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
|
1908
|
+
* the page with the FPS reading
|
|
1908
1909
|
* @param fpsCallback - Callback from the runtime during the RAF loop that supplies the FPS value
|
|
1909
1910
|
*/
|
|
1910
1911
|
Rive.prototype.enableFPSCounter = function (fpsCallback) {
|