@rive-app/webgl 2.32.2 → 2.33.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 +10 -0
- package/rive.js +39 -21
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +2 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export declare enum Alignment {
|
|
|
33
33
|
BottomCenter = "bottomCenter",
|
|
34
34
|
BottomRight = "bottomRight"
|
|
35
35
|
}
|
|
36
|
+
export declare enum DrawOptimizationOptions {
|
|
37
|
+
AlwaysDraw = "alwaysDraw",
|
|
38
|
+
DrawOnChanged = "drawOnChanged"
|
|
39
|
+
}
|
|
36
40
|
export interface LayoutParameters {
|
|
37
41
|
fit?: Fit;
|
|
38
42
|
alignment?: Alignment;
|
|
@@ -260,6 +264,10 @@ export interface RiveParameters {
|
|
|
260
264
|
* Enables multi touch support
|
|
261
265
|
*/
|
|
262
266
|
enableMultiTouch?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Enum with drawing options for optimizations
|
|
269
|
+
*/
|
|
270
|
+
drawingOptions?: DrawOptimizationOptions;
|
|
263
271
|
onLoad?: EventCallback;
|
|
264
272
|
onLoadError?: EventCallback;
|
|
265
273
|
onPlay?: EventCallback;
|
|
@@ -421,6 +429,7 @@ export declare class Rive {
|
|
|
421
429
|
private _boundDraw;
|
|
422
430
|
private _viewModelInstance;
|
|
423
431
|
private _dataEnums;
|
|
432
|
+
private drawOptimization;
|
|
424
433
|
durations: number[];
|
|
425
434
|
frameTimes: number[];
|
|
426
435
|
frameCount: number;
|
|
@@ -700,6 +709,7 @@ export declare class Rive {
|
|
|
700
709
|
* renderer is already active, then this will have zero effect.
|
|
701
710
|
*/
|
|
702
711
|
startRendering(): void;
|
|
712
|
+
private scheduleRendering;
|
|
703
713
|
/**
|
|
704
714
|
* Enables frames-per-second (FPS) reporting for the runtime
|
|
705
715
|
* If no callback is provided, Rive will append a fixed-position div at the top-right corner of
|
package/rive.js
CHANGED
|
@@ -393,7 +393,7 @@ function Ra(a, b) {
|
|
|
393
393
|
return Qa(c, a, b);
|
|
394
394
|
}));
|
|
395
395
|
}
|
|
396
|
-
var Sa, Ta, Xa = {
|
|
396
|
+
var Sa, Ta, Xa = {722402:(a, b, c, d, e) => {
|
|
397
397
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
398
398
|
return 0;
|
|
399
399
|
}
|
|
@@ -456,11 +456,11 @@ var Sa, Ta, Xa = {720208:(a, b, c, d, e) => {
|
|
|
456
456
|
}
|
|
457
457
|
window.h.Ca += 1;
|
|
458
458
|
return 1;
|
|
459
|
-
},
|
|
459
|
+
}, 724580:() => {
|
|
460
460
|
"undefined" !== typeof window.h && (window.h.Ra.map(function(a) {
|
|
461
461
|
document.removeEventListener(a, window.h.unlock, !0);
|
|
462
462
|
}), --window.h.Ca, 0 === window.h.Ca && delete window.h);
|
|
463
|
-
},
|
|
463
|
+
}, 724884:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 724988:() => {
|
|
464
464
|
try {
|
|
465
465
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
466
466
|
a.close();
|
|
@@ -468,7 +468,7 @@ var Sa, Ta, Xa = {720208:(a, b, c, d, e) => {
|
|
|
468
468
|
} catch (c) {
|
|
469
469
|
return 0;
|
|
470
470
|
}
|
|
471
|
-
},
|
|
471
|
+
}, 725159:(a, b, c, d, e, f) => {
|
|
472
472
|
if ("undefined" === typeof window.h) {
|
|
473
473
|
return -1;
|
|
474
474
|
}
|
|
@@ -514,7 +514,7 @@ var Sa, Ta, Xa = {720208:(a, b, c, d, e) => {
|
|
|
514
514
|
a == window.h.H.Aa && g.W.connect(g.J.destination);
|
|
515
515
|
g.kb = f;
|
|
516
516
|
return window.h.fc(g);
|
|
517
|
-
},
|
|
517
|
+
}, 728036:a => window.h.ra(a).J.sampleRate, 728109:a => {
|
|
518
518
|
a = window.h.ra(a);
|
|
519
519
|
void 0 !== a.W && (a.W.onaudioprocess = function() {
|
|
520
520
|
}, a.W.disconnect(), a.W = void 0);
|
|
@@ -522,13 +522,13 @@ var Sa, Ta, Xa = {720208:(a, b, c, d, e) => {
|
|
|
522
522
|
a.J.close();
|
|
523
523
|
a.J = void 0;
|
|
524
524
|
a.kb = void 0;
|
|
525
|
-
},
|
|
525
|
+
}, 728509:a => {
|
|
526
526
|
window.h.ub(a);
|
|
527
|
-
},
|
|
527
|
+
}, 728559:a => {
|
|
528
528
|
a = window.h.ra(a);
|
|
529
529
|
a.J.resume();
|
|
530
530
|
a.state = window.h.ga.qb;
|
|
531
|
-
},
|
|
531
|
+
}, 728698:a => {
|
|
532
532
|
a = window.h.ra(a);
|
|
533
533
|
a.J.suspend();
|
|
534
534
|
a.state = window.h.ga.stopped;
|
|
@@ -3610,7 +3610,9 @@ var Ie = {__syscall_fcntl64:function(a, b, c) {
|
|
|
3610
3610
|
}
|
|
3611
3611
|
return E.Y;
|
|
3612
3612
|
}
|
|
3613
|
-
}, glBindFramebuffer:Ud, glGetIntegerv:ae, invoke_ii:te, invoke_iii:ue, invoke_iiii:ve, invoke_iiiii:we, invoke_iiiiii:xe, invoke_iiiiiii:ye, invoke_iiiiiiiiii:ze, invoke_v:Ae, invoke_vi:Be, invoke_vii:Ce, invoke_viii:De, invoke_viiii:Ee, invoke_viiiiii:Fe, invoke_viiiiiii:Ge, invoke_viiiiiiii:He,
|
|
3613
|
+
}, glBindFramebuffer:Ud, glGetIntegerv:ae, invoke_ii:te, invoke_iii:ue, invoke_iiii:ve, invoke_iiiii:we, invoke_iiiiii:xe, invoke_iiiiiii:ye, invoke_iiiiiiiiii:ze, invoke_v:Ae, invoke_vi:Be, invoke_vii:Ce, invoke_viii:De, invoke_viiii:Ee, invoke_viiiiii:Fe, invoke_viiiiiii:Ge, invoke_viiiiiiii:He, isWindowsBrowser:function() {
|
|
3614
|
+
return -1 < navigator.platform.indexOf("Win");
|
|
3615
|
+
}, strftime_l:(a, b, c, d) => oe(a, b, c, d)}, W = function() {
|
|
3614
3616
|
function a(c) {
|
|
3615
3617
|
W = c.exports;
|
|
3616
3618
|
ya = W.memory;
|
|
@@ -3899,7 +3901,7 @@ moduleRtn = ca;
|
|
|
3899
3901
|
/* 2 */
|
|
3900
3902
|
/***/ ((module) => {
|
|
3901
3903
|
|
|
3902
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.
|
|
3904
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.33.1","description":"Rive\'s webgl 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.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3903
3905
|
|
|
3904
3906
|
/***/ }),
|
|
3905
3907
|
/* 3 */
|
|
@@ -4714,6 +4716,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4714
4716
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4715
4717
|
/* harmony export */ Alignment: () => (/* binding */ Alignment),
|
|
4716
4718
|
/* harmony export */ DataEnum: () => (/* binding */ DataEnum),
|
|
4719
|
+
/* harmony export */ DrawOptimizationOptions: () => (/* binding */ DrawOptimizationOptions),
|
|
4717
4720
|
/* harmony export */ EventType: () => (/* binding */ EventType),
|
|
4718
4721
|
/* harmony export */ Fit: () => (/* binding */ Fit),
|
|
4719
4722
|
/* harmony export */ Layout: () => (/* binding */ Layout),
|
|
@@ -4861,6 +4864,12 @@ var Alignment;
|
|
|
4861
4864
|
Alignment["BottomCenter"] = "bottomCenter";
|
|
4862
4865
|
Alignment["BottomRight"] = "bottomRight";
|
|
4863
4866
|
})(Alignment || (Alignment = {}));
|
|
4867
|
+
// Drawing optimization options
|
|
4868
|
+
var DrawOptimizationOptions;
|
|
4869
|
+
(function (DrawOptimizationOptions) {
|
|
4870
|
+
DrawOptimizationOptions["AlwaysDraw"] = "alwaysDraw";
|
|
4871
|
+
DrawOptimizationOptions["DrawOnChanged"] = "drawOnChanged";
|
|
4872
|
+
})(DrawOptimizationOptions || (DrawOptimizationOptions = {}));
|
|
4864
4873
|
// Alignment options for Rive animations in a HTML canvas
|
|
4865
4874
|
var Layout = /** @class */ (function () {
|
|
4866
4875
|
function Layout(params) {
|
|
@@ -6183,7 +6192,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
6183
6192
|
var Rive = /** @class */ (function () {
|
|
6184
6193
|
function Rive(params) {
|
|
6185
6194
|
var _this = this;
|
|
6186
|
-
var _a;
|
|
6195
|
+
var _a, _b;
|
|
6187
6196
|
// Tracks if a Rive file is loaded
|
|
6188
6197
|
this.loaded = false;
|
|
6189
6198
|
// Tracks if a Rive file is destroyed
|
|
@@ -6225,6 +6234,7 @@ var Rive = /** @class */ (function () {
|
|
|
6225
6234
|
this._boundDraw = null;
|
|
6226
6235
|
this._viewModelInstance = null;
|
|
6227
6236
|
this._dataEnums = null;
|
|
6237
|
+
this.drawOptimization = DrawOptimizationOptions.DrawOnChanged;
|
|
6228
6238
|
// Durations to generate a frame for the last second. Used for performance profiling.
|
|
6229
6239
|
this.durations = [];
|
|
6230
6240
|
this.frameTimes = [];
|
|
@@ -6264,6 +6274,7 @@ var Rive = /** @class */ (function () {
|
|
|
6264
6274
|
? params.dispatchPointerExit
|
|
6265
6275
|
: this.dispatchPointerExit;
|
|
6266
6276
|
this.enableMultiTouch = !!params.enableMultiTouch;
|
|
6277
|
+
this.drawOptimization = (_b = params.drawingOptions) !== null && _b !== void 0 ? _b : this.drawOptimization;
|
|
6267
6278
|
this.enableRiveAssetCDN =
|
|
6268
6279
|
params.enableRiveAssetCDN === undefined
|
|
6269
6280
|
? true
|
|
@@ -6588,7 +6599,7 @@ var Rive = /** @class */ (function () {
|
|
|
6588
6599
|
}
|
|
6589
6600
|
}
|
|
6590
6601
|
else {
|
|
6591
|
-
this.
|
|
6602
|
+
this.scheduleRendering();
|
|
6592
6603
|
}
|
|
6593
6604
|
};
|
|
6594
6605
|
/**
|
|
@@ -6675,17 +6686,21 @@ var Rive = /** @class */ (function () {
|
|
|
6675
6686
|
this.artboard.advance(elapsedTime);
|
|
6676
6687
|
}
|
|
6677
6688
|
var renderer = this.renderer;
|
|
6678
|
-
// Canvas must be wiped to prevent artifacts
|
|
6679
|
-
renderer.clear();
|
|
6680
|
-
renderer.save();
|
|
6681
|
-
// Update the renderer alignment if necessary
|
|
6682
|
-
this.alignRenderer();
|
|
6683
6689
|
// Do not draw on 0 canvas size
|
|
6684
6690
|
if (!this._hasZeroSize) {
|
|
6685
|
-
this
|
|
6691
|
+
// If there was no dirt on this frame, do not clear and draw
|
|
6692
|
+
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
6693
|
+
this.artboard.didChange()) {
|
|
6694
|
+
// Canvas must be wiped to prevent artifacts
|
|
6695
|
+
renderer.clear();
|
|
6696
|
+
renderer.save();
|
|
6697
|
+
// Update the renderer alignment if necessary
|
|
6698
|
+
this.alignRenderer();
|
|
6699
|
+
this.artboard.draw(renderer);
|
|
6700
|
+
renderer.restore();
|
|
6701
|
+
renderer.flush();
|
|
6702
|
+
}
|
|
6686
6703
|
}
|
|
6687
|
-
renderer.restore();
|
|
6688
|
-
renderer.flush();
|
|
6689
6704
|
// Check for any animations that looped
|
|
6690
6705
|
this.animator.handleLooping();
|
|
6691
6706
|
// Check for any state machines that had a state change
|
|
@@ -6706,7 +6721,7 @@ var Rive = /** @class */ (function () {
|
|
|
6706
6721
|
// https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations
|
|
6707
6722
|
if (this.animator.isPlaying) {
|
|
6708
6723
|
// Request a new rendering frame
|
|
6709
|
-
this.
|
|
6724
|
+
this.scheduleRendering();
|
|
6710
6725
|
}
|
|
6711
6726
|
else if (this.animator.isPaused) {
|
|
6712
6727
|
// Reset the end time so on playback it starts at the correct frame
|
|
@@ -7396,6 +7411,9 @@ var Rive = /** @class */ (function () {
|
|
|
7396
7411
|
* renderer is already active, then this will have zero effect.
|
|
7397
7412
|
*/
|
|
7398
7413
|
Rive.prototype.startRendering = function () {
|
|
7414
|
+
this.drawFrame();
|
|
7415
|
+
};
|
|
7416
|
+
Rive.prototype.scheduleRendering = function () {
|
|
7399
7417
|
if (this.loaded && this.artboard && !this.frameRequestId) {
|
|
7400
7418
|
if (this.runtime.requestAnimationFrame) {
|
|
7401
7419
|
this.frameRequestId = this.runtime.requestAnimationFrame(this._boundDraw);
|