@rive-app/canvas-advanced 2.19.4 → 2.19.5
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/canvas_advanced.mjs +43 -41
- package/package.json +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
package/canvas_advanced.mjs
CHANGED
|
@@ -328,10 +328,10 @@ m.onRuntimeInitialized = function() {
|
|
|
328
328
|
function c() {
|
|
329
329
|
0 < M.length && (ka.Qb(w.drawWidth(), w.drawHeight(), M, T, ca), M = [], ca = T = 0, w.reset(512, 512));
|
|
330
330
|
for (const q of D) {
|
|
331
|
-
for (const z of q.
|
|
331
|
+
for (const z of q.H) {
|
|
332
332
|
z();
|
|
333
333
|
}
|
|
334
|
-
q.
|
|
334
|
+
q.H = [];
|
|
335
335
|
}
|
|
336
336
|
D.clear();
|
|
337
337
|
}
|
|
@@ -461,32 +461,32 @@ m.onRuntimeInitialized = function() {
|
|
|
461
461
|
this.S = [1, 0, 0, 1, 0, 0];
|
|
462
462
|
this.C = q.getContext("2d");
|
|
463
463
|
this.Ua = q;
|
|
464
|
-
this.
|
|
464
|
+
this.H = [];
|
|
465
465
|
}, save:function() {
|
|
466
466
|
this.S.push(...this.S.slice(this.S.length - 6));
|
|
467
|
-
this.
|
|
467
|
+
this.H.push(this.C.save.bind(this.C));
|
|
468
468
|
}, restore:function() {
|
|
469
469
|
const q = this.S.length - 6;
|
|
470
470
|
if (6 > q) {
|
|
471
471
|
throw "restore() called without matching save().";
|
|
472
472
|
}
|
|
473
473
|
this.S.splice(q);
|
|
474
|
-
this.
|
|
474
|
+
this.H.push(this.C.restore.bind(this.C));
|
|
475
475
|
}, transform:function(q, z, G, H, C, I) {
|
|
476
476
|
const J = this.S, K = J.length - 6;
|
|
477
477
|
J.splice(K, 6, J[K] * q + J[K + 2] * z, J[K + 1] * q + J[K + 3] * z, J[K] * G + J[K + 2] * H, J[K + 1] * G + J[K + 3] * H, J[K] * C + J[K + 2] * I + J[K + 4], J[K + 1] * C + J[K + 3] * I + J[K + 5]);
|
|
478
|
-
this.
|
|
478
|
+
this.H.push(this.C.transform.bind(this.C, q, z, G, H, C, I));
|
|
479
479
|
}, rotate:function(q) {
|
|
480
480
|
const z = Math.sin(q);
|
|
481
481
|
q = Math.cos(q);
|
|
482
482
|
this.transform(q, z, -z, q, 0, 0);
|
|
483
483
|
}, _drawPath:function(q, z) {
|
|
484
|
-
this.
|
|
484
|
+
this.H.push(z.draw.bind(z, this.C, q.T, q.Va === x ? "evenodd" : "nonzero"));
|
|
485
485
|
}, _drawRiveImage:function(q, z, G) {
|
|
486
486
|
var H = q.Fb;
|
|
487
487
|
if (H) {
|
|
488
488
|
var C = this.C, I = a(z);
|
|
489
|
-
this.
|
|
489
|
+
this.H.push(function() {
|
|
490
490
|
C.globalCompositeOperation = I;
|
|
491
491
|
C.globalAlpha = G;
|
|
492
492
|
C.drawImage(H, 0, 0);
|
|
@@ -523,7 +523,7 @@ m.onRuntimeInitialized = function() {
|
|
|
523
523
|
T += H.length;
|
|
524
524
|
ca += I.length;
|
|
525
525
|
var za = this.C, qd = a(z);
|
|
526
|
-
this.
|
|
526
|
+
this.H.push(function() {
|
|
527
527
|
za.save();
|
|
528
528
|
za.resetTransform();
|
|
529
529
|
za.globalCompositeOperation = qd;
|
|
@@ -534,10 +534,10 @@ m.onRuntimeInitialized = function() {
|
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
536
|
}, _clipPath:function(q) {
|
|
537
|
-
this.
|
|
537
|
+
this.H.push(this.C.clip.bind(this.C, q.T, q.Va === x ? "evenodd" : "nonzero"));
|
|
538
538
|
}, clear:function() {
|
|
539
539
|
D.add(this);
|
|
540
|
-
this.
|
|
540
|
+
this.H.push(this.C.clearRect.bind(this.C, 0, 0, this.Ua.width, this.Ua.height));
|
|
541
541
|
}, flush:function() {
|
|
542
542
|
}, translate:function(q, z) {
|
|
543
543
|
this.transform(1, 0, 0, 1, q, z);
|
|
@@ -555,13 +555,15 @@ m.onRuntimeInitialized = function() {
|
|
|
555
555
|
throw Error("RiveException: Method call to '" + C + "()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");
|
|
556
556
|
}
|
|
557
557
|
return function(...I) {
|
|
558
|
-
z.
|
|
558
|
+
z.H.push(G[C].bind(G, ...I));
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
561
|
return H[C];
|
|
562
562
|
}, set(H, C, I) {
|
|
563
563
|
if (C in G) {
|
|
564
|
-
return
|
|
564
|
+
return z.H.push(() => {
|
|
565
|
+
G[C] = I;
|
|
566
|
+
}), !0;
|
|
565
567
|
}
|
|
566
568
|
},});
|
|
567
569
|
};
|
|
@@ -715,16 +717,16 @@ function Ya(a, b) {
|
|
|
715
717
|
return Xa(c, a, b);
|
|
716
718
|
}));
|
|
717
719
|
}
|
|
718
|
-
var Za, $a, db = {
|
|
720
|
+
var Za, $a, db = {434540:(a, b, c, d, e) => {
|
|
719
721
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
720
722
|
return 0;
|
|
721
723
|
}
|
|
722
724
|
if ("undefined" === typeof window.h) {
|
|
723
725
|
window.h = {Aa:0};
|
|
724
|
-
window.h.
|
|
725
|
-
window.h.
|
|
726
|
-
window.h.
|
|
727
|
-
window.h.
|
|
726
|
+
window.h.I = {};
|
|
727
|
+
window.h.I.ya = a;
|
|
728
|
+
window.h.I.capture = b;
|
|
729
|
+
window.h.I.La = c;
|
|
728
730
|
window.h.ga = {};
|
|
729
731
|
window.h.ga.stopped = d;
|
|
730
732
|
window.h.ga.xb = e;
|
|
@@ -762,7 +764,7 @@ var Za, $a, db = {433532:(a, b, c, d, e) => {
|
|
|
762
764
|
f.unlock = function() {
|
|
763
765
|
for (var g = 0; g < f.D.length; ++g) {
|
|
764
766
|
var n = f.D[g];
|
|
765
|
-
null != n && null != n.
|
|
767
|
+
null != n && null != n.J && n.state === f.ga.xb && n.J.resume().then(() => {
|
|
766
768
|
ab(n.pb);
|
|
767
769
|
}, p => {
|
|
768
770
|
console.error("Failed to resume audiocontext", p);
|
|
@@ -778,9 +780,9 @@ var Za, $a, db = {433532:(a, b, c, d, e) => {
|
|
|
778
780
|
}
|
|
779
781
|
window.h.Aa += 1;
|
|
780
782
|
return 1;
|
|
781
|
-
},
|
|
783
|
+
}, 436718:() => {
|
|
782
784
|
"undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
|
|
783
|
-
},
|
|
785
|
+
}, 436882:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 436986:() => {
|
|
784
786
|
try {
|
|
785
787
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
786
788
|
a.close();
|
|
@@ -788,23 +790,23 @@ var Za, $a, db = {433532:(a, b, c, d, e) => {
|
|
|
788
790
|
} catch (c) {
|
|
789
791
|
return 0;
|
|
790
792
|
}
|
|
791
|
-
},
|
|
793
|
+
}, 437157:(a, b, c, d, e, f) => {
|
|
792
794
|
if ("undefined" === typeof window.h) {
|
|
793
795
|
return -1;
|
|
794
796
|
}
|
|
795
797
|
var g = {}, n = {};
|
|
796
|
-
a == window.h.
|
|
797
|
-
g.
|
|
798
|
-
g.
|
|
798
|
+
a == window.h.I.ya && 0 != c && (n.sampleRate = c);
|
|
799
|
+
g.J = new (window.AudioContext || window.webkitAudioContext)(n);
|
|
800
|
+
g.J.suspend();
|
|
799
801
|
g.state = window.h.ga.stopped;
|
|
800
802
|
c = 0;
|
|
801
|
-
a != window.h.
|
|
802
|
-
g.Z = g.
|
|
803
|
+
a != window.h.I.ya && (c = b);
|
|
804
|
+
g.Z = g.J.createScriptProcessor(d, c, b);
|
|
803
805
|
g.Z.onaudioprocess = function(p) {
|
|
804
806
|
if (null == g.sa || 0 == g.sa.length) {
|
|
805
807
|
g.sa = new Float32Array(Fa.buffer, e, d * b);
|
|
806
808
|
}
|
|
807
|
-
if (a == window.h.
|
|
809
|
+
if (a == window.h.I.capture || a == window.h.I.La) {
|
|
808
810
|
for (var l = 0; l < b; l += 1) {
|
|
809
811
|
for (var u = p.inputBuffer.getChannelData(l), v = g.sa, x = 0; x < d; x += 1) {
|
|
810
812
|
v[x * b + l] = u[x];
|
|
@@ -812,7 +814,7 @@ var Za, $a, db = {433532:(a, b, c, d, e) => {
|
|
|
812
814
|
}
|
|
813
815
|
bb(f, d, e);
|
|
814
816
|
}
|
|
815
|
-
if (a == window.h.
|
|
817
|
+
if (a == window.h.I.ya || a == window.h.I.La) {
|
|
816
818
|
for (cb(f, d, e), l = 0; l < p.outputBuffer.numberOfChannels; ++l) {
|
|
817
819
|
for (u = p.outputBuffer.getChannelData(l), v = g.sa, x = 0; x < d; x += 1) {
|
|
818
820
|
u[x] = v[x * b + l];
|
|
@@ -824,33 +826,33 @@ var Za, $a, db = {433532:(a, b, c, d, e) => {
|
|
|
824
826
|
}
|
|
825
827
|
}
|
|
826
828
|
};
|
|
827
|
-
a != window.h.
|
|
828
|
-
g.Da = g.
|
|
829
|
+
a != window.h.I.capture && a != window.h.I.La || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(p) {
|
|
830
|
+
g.Da = g.J.createMediaStreamSource(p);
|
|
829
831
|
g.Da.connect(g.Z);
|
|
830
|
-
g.Z.connect(g.
|
|
832
|
+
g.Z.connect(g.J.destination);
|
|
831
833
|
}).catch(function(p) {
|
|
832
834
|
console.log("Failed to get user media: " + p);
|
|
833
835
|
});
|
|
834
|
-
a == window.h.
|
|
836
|
+
a == window.h.I.ya && g.Z.connect(g.J.destination);
|
|
835
837
|
g.pb = f;
|
|
836
838
|
return window.h.yc(g);
|
|
837
|
-
},
|
|
839
|
+
}, 440034:a => window.h.ra(a).J.sampleRate, 440107:a => {
|
|
838
840
|
a = window.h.ra(a);
|
|
839
841
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
840
842
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
841
843
|
void 0 !== a.Da && (a.Da.disconnect(), a.Da = void 0);
|
|
842
|
-
a.
|
|
843
|
-
a.
|
|
844
|
+
a.J.close();
|
|
845
|
+
a.J = void 0;
|
|
844
846
|
a.pb = void 0;
|
|
845
|
-
},
|
|
847
|
+
}, 440507:a => {
|
|
846
848
|
window.h.Cb(a);
|
|
847
|
-
},
|
|
849
|
+
}, 440557:a => {
|
|
848
850
|
a = window.h.ra(a);
|
|
849
|
-
a.
|
|
851
|
+
a.J.resume();
|
|
850
852
|
a.state = window.h.ga.xb;
|
|
851
|
-
},
|
|
853
|
+
}, 440696:a => {
|
|
852
854
|
a = window.h.ra(a);
|
|
853
|
-
a.
|
|
855
|
+
a.J.suspend();
|
|
854
856
|
a.state = window.h.ga.stopped;
|
|
855
857
|
}}, eb = a => {
|
|
856
858
|
for (; 0 < a.length;) {
|
package/package.json
CHANGED
package/rive.wasm
CHANGED
|
Binary file
|
package/rive_fallback.wasm
CHANGED
|
Binary file
|