@rive-app/webgl2 2.23.11 → 2.24.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 +4 -0
- package/rive.js +60 -46
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -103,6 +103,10 @@ export declare class StateMachineInput {
|
|
|
103
103
|
* Fires a trigger; does nothing on Number or Boolean input types
|
|
104
104
|
*/
|
|
105
105
|
fire(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Deletes the input
|
|
108
|
+
*/
|
|
109
|
+
delete(): void;
|
|
106
110
|
}
|
|
107
111
|
export declare enum RiveEventType {
|
|
108
112
|
General = 128,
|
package/rive.js
CHANGED
|
@@ -190,7 +190,7 @@ m.onRuntimeInitialized = function() {
|
|
|
190
190
|
if (!q) {
|
|
191
191
|
return null;
|
|
192
192
|
}
|
|
193
|
-
var y = ha(r), B = {handle:y, attributes:v, version:v.Dc,
|
|
193
|
+
var y = ha(r), B = {handle:y, attributes:v, version:v.Dc, J:q};
|
|
194
194
|
q.canvas && (q.canvas.oc = B);
|
|
195
195
|
r[y] = B;
|
|
196
196
|
("undefined" == typeof v.Ib || v.Ib) && ia(B);
|
|
@@ -427,16 +427,16 @@ function Na(a, b) {
|
|
|
427
427
|
return Ma(c, a, b);
|
|
428
428
|
}));
|
|
429
429
|
}
|
|
430
|
-
var Oa, Pa, Ta = {
|
|
430
|
+
var Oa, Pa, Ta = {494190:(a, b, c, d, e) => {
|
|
431
431
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
432
432
|
return 0;
|
|
433
433
|
}
|
|
434
434
|
if ("undefined" === typeof window.h) {
|
|
435
435
|
window.h = {Da:0};
|
|
436
|
-
window.h.
|
|
437
|
-
window.h.
|
|
438
|
-
window.h.
|
|
439
|
-
window.h.
|
|
436
|
+
window.h.H = {};
|
|
437
|
+
window.h.H.Ba = a;
|
|
438
|
+
window.h.H.capture = b;
|
|
439
|
+
window.h.H.La = c;
|
|
440
440
|
window.h.ia = {};
|
|
441
441
|
window.h.ia.stopped = d;
|
|
442
442
|
window.h.ia.sb = e;
|
|
@@ -474,7 +474,7 @@ var Oa, Pa, Ta = {491878:(a, b, c, d, e) => {
|
|
|
474
474
|
f.unlock = function() {
|
|
475
475
|
for (var g = 0; g < f.C.length; ++g) {
|
|
476
476
|
var n = f.C[g];
|
|
477
|
-
null != n && null != n.
|
|
477
|
+
null != n && null != n.I && n.state === f.ia.sb && n.I.resume().then(() => {
|
|
478
478
|
Qa(n.kb);
|
|
479
479
|
}, p => {
|
|
480
480
|
console.error("Failed to resume audiocontext", p);
|
|
@@ -490,9 +490,9 @@ var Oa, Pa, Ta = {491878:(a, b, c, d, e) => {
|
|
|
490
490
|
}
|
|
491
491
|
window.h.Da += 1;
|
|
492
492
|
return 1;
|
|
493
|
-
},
|
|
493
|
+
}, 496368:() => {
|
|
494
494
|
"undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
|
|
495
|
-
},
|
|
495
|
+
}, 496532:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 496636:() => {
|
|
496
496
|
try {
|
|
497
497
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
498
498
|
a.close();
|
|
@@ -500,23 +500,23 @@ var Oa, Pa, Ta = {491878:(a, b, c, d, e) => {
|
|
|
500
500
|
} catch (c) {
|
|
501
501
|
return 0;
|
|
502
502
|
}
|
|
503
|
-
},
|
|
503
|
+
}, 496807:(a, b, c, d, e, f) => {
|
|
504
504
|
if ("undefined" === typeof window.h) {
|
|
505
505
|
return -1;
|
|
506
506
|
}
|
|
507
507
|
var g = {}, n = {};
|
|
508
|
-
a == window.h.
|
|
509
|
-
g.
|
|
510
|
-
g.
|
|
508
|
+
a == window.h.H.Ba && 0 != c && (n.sampleRate = c);
|
|
509
|
+
g.I = new (window.AudioContext || window.webkitAudioContext)(n);
|
|
510
|
+
g.I.suspend();
|
|
511
511
|
g.state = window.h.ia.stopped;
|
|
512
512
|
c = 0;
|
|
513
|
-
a != window.h.
|
|
514
|
-
g.Z = g.
|
|
513
|
+
a != window.h.H.Ba && (c = b);
|
|
514
|
+
g.Z = g.I.createScriptProcessor(d, c, b);
|
|
515
515
|
g.Z.onaudioprocess = function(p) {
|
|
516
516
|
if (null == g.wa || 0 == g.wa.length) {
|
|
517
517
|
g.wa = new Float32Array(wa.buffer, e, d * b);
|
|
518
518
|
}
|
|
519
|
-
if (a == window.h.
|
|
519
|
+
if (a == window.h.H.capture || a == window.h.H.La) {
|
|
520
520
|
for (var l = 0; l < b; l += 1) {
|
|
521
521
|
for (var t = p.inputBuffer.getChannelData(l), u = g.wa, x = 0; x < d; x += 1) {
|
|
522
522
|
u[x * b + l] = t[x];
|
|
@@ -524,7 +524,7 @@ var Oa, Pa, Ta = {491878:(a, b, c, d, e) => {
|
|
|
524
524
|
}
|
|
525
525
|
Ra(f, d, e);
|
|
526
526
|
}
|
|
527
|
-
if (a == window.h.
|
|
527
|
+
if (a == window.h.H.Ba || a == window.h.H.La) {
|
|
528
528
|
for (Sa(f, d, e), l = 0; l < p.outputBuffer.numberOfChannels; ++l) {
|
|
529
529
|
for (t = p.outputBuffer.getChannelData(l), u = g.wa, x = 0; x < d; x += 1) {
|
|
530
530
|
t[x] = u[x * b + l];
|
|
@@ -536,33 +536,33 @@ var Oa, Pa, Ta = {491878:(a, b, c, d, e) => {
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
};
|
|
539
|
-
a != window.h.
|
|
540
|
-
g.Ea = g.
|
|
539
|
+
a != window.h.H.capture && a != window.h.H.La || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(p) {
|
|
540
|
+
g.Ea = g.I.createMediaStreamSource(p);
|
|
541
541
|
g.Ea.connect(g.Z);
|
|
542
|
-
g.Z.connect(g.
|
|
542
|
+
g.Z.connect(g.I.destination);
|
|
543
543
|
}).catch(function(p) {
|
|
544
544
|
console.log("Failed to get user media: " + p);
|
|
545
545
|
});
|
|
546
|
-
a == window.h.
|
|
546
|
+
a == window.h.H.Ba && g.Z.connect(g.I.destination);
|
|
547
547
|
g.kb = f;
|
|
548
548
|
return window.h.mc(g);
|
|
549
|
-
},
|
|
549
|
+
}, 499684:a => window.h.va(a).I.sampleRate, 499757:a => {
|
|
550
550
|
a = window.h.va(a);
|
|
551
551
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
552
552
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
553
553
|
void 0 !== a.Ea && (a.Ea.disconnect(), a.Ea = void 0);
|
|
554
|
-
a.
|
|
555
|
-
a.
|
|
554
|
+
a.I.close();
|
|
555
|
+
a.I = void 0;
|
|
556
556
|
a.kb = void 0;
|
|
557
|
-
},
|
|
557
|
+
}, 500157:a => {
|
|
558
558
|
window.h.xb(a);
|
|
559
|
-
},
|
|
559
|
+
}, 500207:a => {
|
|
560
560
|
a = window.h.va(a);
|
|
561
|
-
a.
|
|
561
|
+
a.I.resume();
|
|
562
562
|
a.state = window.h.ia.sb;
|
|
563
|
-
},
|
|
563
|
+
}, 500346:a => {
|
|
564
564
|
a = window.h.va(a);
|
|
565
|
-
a.
|
|
565
|
+
a.I.suspend();
|
|
566
566
|
a.state = window.h.ia.stopped;
|
|
567
567
|
}}, Ua = a => {
|
|
568
568
|
for (; 0 < a.length;) {
|
|
@@ -1829,14 +1829,14 @@ function ha(a) {
|
|
|
1829
1829
|
}
|
|
1830
1830
|
function ja(a) {
|
|
1831
1831
|
Dd = r[a];
|
|
1832
|
-
m.xc = Z = Dd && Dd.
|
|
1832
|
+
m.xc = Z = Dd && Dd.J;
|
|
1833
1833
|
return !(a && !Z);
|
|
1834
1834
|
}
|
|
1835
1835
|
function ia(a) {
|
|
1836
1836
|
a || (a = Dd);
|
|
1837
1837
|
if (!a.Tb) {
|
|
1838
1838
|
a.Tb = !0;
|
|
1839
|
-
var b = a.
|
|
1839
|
+
var b = a.J;
|
|
1840
1840
|
sd(b);
|
|
1841
1841
|
td(b);
|
|
1842
1842
|
2 <= a.version && (b.Za = b.getExtension("EXT_disjoint_timer_query_webgl2"));
|
|
@@ -2897,7 +2897,7 @@ var Wd = {__syscall_fcntl64:function(a, b, c) {
|
|
|
2897
2897
|
}, abort:() => {
|
|
2898
2898
|
sa("");
|
|
2899
2899
|
}, beginPixelLocalStorageWEBGL:function(a, b, c) {
|
|
2900
|
-
(a = r[a].
|
|
2900
|
+
(a = r[a].J.ja) && a.beginPixelLocalStorageWEBGL(m.HEAPU32.subarray(c, c + b));
|
|
2901
2901
|
}, decode_image:function(a, b, c) {
|
|
2902
2902
|
var d = m.images;
|
|
2903
2903
|
d || (d = new Map(), m.images = d);
|
|
@@ -2956,21 +2956,21 @@ var Wd = {__syscall_fcntl64:function(a, b, c) {
|
|
|
2956
2956
|
"WEBGL_draw_instanced_base_vertex_base_instance" == b && sd(Z);
|
|
2957
2957
|
"WEBGL_multi_draw_instanced_base_vertex_base_instance" == b && td(Z);
|
|
2958
2958
|
"WEBGL_multi_draw" == b && Ed(Z);
|
|
2959
|
-
return !!a.
|
|
2959
|
+
return !!a.J.getExtension(b);
|
|
2960
2960
|
}, emscripten_webgl_get_current_context:function() {
|
|
2961
2961
|
return Dd ? Dd.handle : 0;
|
|
2962
2962
|
}, emscripten_webgl_make_context_current:function(a) {
|
|
2963
2963
|
return ja(a) ? 0 : -5;
|
|
2964
2964
|
}, enable_WEBGL_provoking_vertex:function(a) {
|
|
2965
|
-
a = r[a].
|
|
2965
|
+
a = r[a].J;
|
|
2966
2966
|
a.mb = a.getExtension("WEBGL_provoking_vertex");
|
|
2967
2967
|
return !!a.mb;
|
|
2968
2968
|
}, enable_WEBGL_shader_pixel_local_storage_coherent:function(a) {
|
|
2969
|
-
a = r[a].
|
|
2969
|
+
a = r[a].J;
|
|
2970
2970
|
a.ja = a.getExtension("WEBGL_shader_pixel_local_storage");
|
|
2971
2971
|
return !(!a.ja || !a.ja.isCoherent());
|
|
2972
2972
|
}, endPixelLocalStorageWEBGL:function(a, b, c) {
|
|
2973
|
-
(a = r[a].
|
|
2973
|
+
(a = r[a].J.ja) && a.endPixelLocalStorageWEBGL(m.HEAPU32.subarray(c, c + b));
|
|
2974
2974
|
}, environ_get:(a, b) => {
|
|
2975
2975
|
var c = 0;
|
|
2976
2976
|
Hd().forEach(function(d, e) {
|
|
@@ -3138,9 +3138,9 @@ var Wd = {__syscall_fcntl64:function(a, b, c) {
|
|
|
3138
3138
|
return D.aa;
|
|
3139
3139
|
}
|
|
3140
3140
|
}, framebufferPixelLocalClearValuefvWEBGL:function(a, b, c, d, e, f) {
|
|
3141
|
-
(a = r[a].
|
|
3141
|
+
(a = r[a].J.ja) && a.framebufferPixelLocalClearValuefvWEBGL(b, [c, d, e, f]);
|
|
3142
3142
|
}, framebufferTexturePixelLocalStorageWEBGL:function(a, b, c, d, e) {
|
|
3143
|
-
(a = r[a].
|
|
3143
|
+
(a = r[a].J.ja) && a.framebufferTexturePixelLocalStorageWEBGL(b, yd[c], d, e);
|
|
3144
3144
|
}, glActiveTexture:function(a) {
|
|
3145
3145
|
Z.activeTexture(a);
|
|
3146
3146
|
}, glAttachShader:function(a, b) {
|
|
@@ -3414,13 +3414,10 @@ var Wd = {__syscall_fcntl64:function(a, b, c) {
|
|
|
3414
3414
|
}, glViewport:function(a, b, c, d) {
|
|
3415
3415
|
Z.viewport(a, b, c, d);
|
|
3416
3416
|
}, provokingVertexWEBGL:function(a, b) {
|
|
3417
|
-
(a = r[a].
|
|
3417
|
+
(a = r[a].J.mb) && a.provokingVertexWEBGL(b);
|
|
3418
3418
|
}, strftime_l:(a, b, c, d) => Rd(a, b, c, d), upload_image:function(a, b) {
|
|
3419
3419
|
var c = m.images;
|
|
3420
|
-
c && (b = c.get(b)) && (a = r[a].
|
|
3421
|
-
}, webgl_texSubImage2DWithOffset:function(a, b, c, d, e, f, g, n, p, l) {
|
|
3422
|
-
a = r[a].H;
|
|
3423
|
-
a.texSubImage2D(b, c, d, e, f, g, n, p, l);
|
|
3420
|
+
c && (b = c.get(b)) && (a = r[a].J, a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, a.RGBA, a.UNSIGNED_BYTE, b));
|
|
3424
3421
|
}};
|
|
3425
3422
|
(function() {
|
|
3426
3423
|
function a(c) {
|
|
@@ -3469,8 +3466,8 @@ m.dynCall_viijii = (a, b, c, d, e, f, g) => (m.dynCall_viijii = A.dynCall_viijii
|
|
|
3469
3466
|
m.dynCall_iiiiij = (a, b, c, d, e, f, g) => (m.dynCall_iiiiij = A.dynCall_iiiiij)(a, b, c, d, e, f, g);
|
|
3470
3467
|
m.dynCall_iiiiijj = (a, b, c, d, e, f, g, n, p) => (m.dynCall_iiiiijj = A.dynCall_iiiiijj)(a, b, c, d, e, f, g, n, p);
|
|
3471
3468
|
m.dynCall_iiiiiijj = (a, b, c, d, e, f, g, n, p, l) => (m.dynCall_iiiiiijj = A.dynCall_iiiiiijj)(a, b, c, d, e, f, g, n, p, l);
|
|
3472
|
-
m.___start_em_js =
|
|
3473
|
-
m.___stop_em_js =
|
|
3469
|
+
m.___start_em_js = 491756;
|
|
3470
|
+
m.___stop_em_js = 494190;
|
|
3474
3471
|
var Xd;
|
|
3475
3472
|
Ga = function Yd() {
|
|
3476
3473
|
Xd || Zd();
|
|
@@ -3530,7 +3527,7 @@ Zd();
|
|
|
3530
3527
|
/* 2 */
|
|
3531
3528
|
/***/ ((module) => {
|
|
3532
3529
|
|
|
3533
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
3530
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.24.1","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3534
3531
|
|
|
3535
3532
|
/***/ }),
|
|
3536
3533
|
/* 3 */
|
|
@@ -4324,6 +4321,12 @@ var StateMachineInput = /** @class */ (function () {
|
|
|
4324
4321
|
this.runtimeInput.fire();
|
|
4325
4322
|
}
|
|
4326
4323
|
};
|
|
4324
|
+
/**
|
|
4325
|
+
* Deletes the input
|
|
4326
|
+
*/
|
|
4327
|
+
StateMachineInput.prototype.delete = function () {
|
|
4328
|
+
this.runtimeInput = null;
|
|
4329
|
+
};
|
|
4327
4330
|
return StateMachineInput;
|
|
4328
4331
|
}());
|
|
4329
4332
|
|
|
@@ -4425,6 +4428,10 @@ var StateMachine = /** @class */ (function () {
|
|
|
4425
4428
|
* state machine is no more.
|
|
4426
4429
|
*/
|
|
4427
4430
|
StateMachine.prototype.cleanup = function () {
|
|
4431
|
+
this.inputs.forEach(function (input) {
|
|
4432
|
+
input.delete();
|
|
4433
|
+
});
|
|
4434
|
+
this.inputs.length = 0;
|
|
4428
4435
|
this.instance.delete();
|
|
4429
4436
|
};
|
|
4430
4437
|
return StateMachine;
|
|
@@ -5269,6 +5276,8 @@ var Rive = /** @class */ (function () {
|
|
|
5269
5276
|
var _a;
|
|
5270
5277
|
// Tracks if a Rive file is loaded
|
|
5271
5278
|
this.loaded = false;
|
|
5279
|
+
// Reference of an object that handles any observers for the animation
|
|
5280
|
+
this._observed = null;
|
|
5272
5281
|
/**
|
|
5273
5282
|
* Tracks if a Rive file is loaded; we need this in addition to loaded as some
|
|
5274
5283
|
* commands (e.g. contents) can be called as soon as the file is loaded.
|
|
@@ -5410,6 +5419,8 @@ var Rive = /** @class */ (function () {
|
|
|
5410
5419
|
RuntimeLoader.awaitInstance()
|
|
5411
5420
|
.then(function (runtime) {
|
|
5412
5421
|
_this.runtime = runtime;
|
|
5422
|
+
_this.removeRiveListeners();
|
|
5423
|
+
_this.deleteRiveRenderer();
|
|
5413
5424
|
// Get the canvas where you want to render the animation and create a renderer
|
|
5414
5425
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
5415
5426
|
// Initial size adjustment based on devicePixelRatio if no width/height are
|
|
@@ -5464,6 +5475,7 @@ var Rive = /** @class */ (function () {
|
|
|
5464
5475
|
Rive.prototype.removeRiveListeners = function () {
|
|
5465
5476
|
if (this.eventCleanup) {
|
|
5466
5477
|
this.eventCleanup();
|
|
5478
|
+
this.eventCleanup = null;
|
|
5467
5479
|
}
|
|
5468
5480
|
};
|
|
5469
5481
|
/**
|
|
@@ -5768,9 +5780,11 @@ var Rive = /** @class */ (function () {
|
|
|
5768
5780
|
if (this._observed !== null) {
|
|
5769
5781
|
observers.remove(this._observed);
|
|
5770
5782
|
}
|
|
5783
|
+
this.removeRiveListeners();
|
|
5771
5784
|
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
5772
5785
|
this.riveFile = null;
|
|
5773
5786
|
this.file = null;
|
|
5787
|
+
this.deleteRiveRenderer();
|
|
5774
5788
|
};
|
|
5775
5789
|
/**
|
|
5776
5790
|
* Cleans up the Renderer object. Only call this API if you no longer
|