@rive-app/canvas 2.25.0 → 2.25.2
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 +1 -0
- package/rive.js +30 -14
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +6 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
package/rive.js
CHANGED
|
@@ -746,7 +746,7 @@ function Ya(a, b) {
|
|
|
746
746
|
return Xa(c, a, b);
|
|
747
747
|
}));
|
|
748
748
|
}
|
|
749
|
-
var Za, $a, db = {
|
|
749
|
+
var Za, $a, db = {445468:(a, b, c, d, e) => {
|
|
750
750
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
751
751
|
return 0;
|
|
752
752
|
}
|
|
@@ -809,9 +809,9 @@ var Za, $a, db = {445196:(a, b, c, d, e) => {
|
|
|
809
809
|
}
|
|
810
810
|
window.h.Aa += 1;
|
|
811
811
|
return 1;
|
|
812
|
-
},
|
|
812
|
+
}, 447646:() => {
|
|
813
813
|
"undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
|
|
814
|
-
},
|
|
814
|
+
}, 447810:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 447914:() => {
|
|
815
815
|
try {
|
|
816
816
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
817
817
|
a.close();
|
|
@@ -819,7 +819,7 @@ var Za, $a, db = {445196:(a, b, c, d, e) => {
|
|
|
819
819
|
} catch (c) {
|
|
820
820
|
return 0;
|
|
821
821
|
}
|
|
822
|
-
},
|
|
822
|
+
}, 448085:(a, b, c, d, e, f) => {
|
|
823
823
|
if ("undefined" === typeof window.h) {
|
|
824
824
|
return -1;
|
|
825
825
|
}
|
|
@@ -865,7 +865,7 @@ var Za, $a, db = {445196:(a, b, c, d, e) => {
|
|
|
865
865
|
a == window.h.I.ya && g.Z.connect(g.J.destination);
|
|
866
866
|
g.pb = f;
|
|
867
867
|
return window.h.yc(g);
|
|
868
|
-
},
|
|
868
|
+
}, 450962:a => window.h.ra(a).J.sampleRate, 451035:a => {
|
|
869
869
|
a = window.h.ra(a);
|
|
870
870
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
871
871
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
@@ -873,13 +873,13 @@ var Za, $a, db = {445196:(a, b, c, d, e) => {
|
|
|
873
873
|
a.J.close();
|
|
874
874
|
a.J = void 0;
|
|
875
875
|
a.pb = void 0;
|
|
876
|
-
},
|
|
876
|
+
}, 451435:a => {
|
|
877
877
|
window.h.Cb(a);
|
|
878
|
-
},
|
|
878
|
+
}, 451485:a => {
|
|
879
879
|
a = window.h.ra(a);
|
|
880
880
|
a.J.resume();
|
|
881
881
|
a.state = window.h.ga.xb;
|
|
882
|
-
},
|
|
882
|
+
}, 451624:a => {
|
|
883
883
|
a = window.h.ra(a);
|
|
884
884
|
a.J.suspend();
|
|
885
885
|
a.state = window.h.ga.stopped;
|
|
@@ -3365,7 +3365,7 @@ $d();
|
|
|
3365
3365
|
/* 2 */
|
|
3366
3366
|
/***/ ((module) => {
|
|
3367
3367
|
|
|
3368
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.25.
|
|
3368
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.25.2","description":"Rive\'s canvas 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.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3369
3369
|
|
|
3370
3370
|
/***/ }),
|
|
3371
3371
|
/* 3 */
|
|
@@ -4218,6 +4218,13 @@ var StateMachine = /** @class */ (function () {
|
|
|
4218
4218
|
StateMachine.prototype.advance = function (time) {
|
|
4219
4219
|
this.instance.advance(time);
|
|
4220
4220
|
};
|
|
4221
|
+
/**
|
|
4222
|
+
* Advances the state machine instance by a given time and apply changes to artboard.
|
|
4223
|
+
* @param time - the time to advance the animation by in seconds
|
|
4224
|
+
*/
|
|
4225
|
+
StateMachine.prototype.advanceAndApply = function (time) {
|
|
4226
|
+
this.instance.advanceAndApply(time);
|
|
4227
|
+
};
|
|
4221
4228
|
/**
|
|
4222
4229
|
* Returns the number of events reported from the last advance call
|
|
4223
4230
|
* @returns Number of events reported
|
|
@@ -5142,6 +5149,8 @@ var Rive = /** @class */ (function () {
|
|
|
5142
5149
|
this._devicePixelRatioUsed = 1;
|
|
5143
5150
|
// Whether the canvas element's size is 0
|
|
5144
5151
|
this._hasZeroSize = false;
|
|
5152
|
+
// Audio event listener
|
|
5153
|
+
this._audioEventListener = null;
|
|
5145
5154
|
// Durations to generate a frame for the last second. Used for performance profiling.
|
|
5146
5155
|
this.durations = [];
|
|
5147
5156
|
this.frameTimes = [];
|
|
@@ -5325,11 +5334,12 @@ var Rive = /** @class */ (function () {
|
|
|
5325
5334
|
var _a;
|
|
5326
5335
|
// Initialize audio if needed
|
|
5327
5336
|
if (audioManager.status == SystemAudioStatus.UNAVAILABLE) {
|
|
5328
|
-
if ((_a = this.artboard) === null || _a === void 0 ? void 0 : _a.hasAudio) {
|
|
5329
|
-
|
|
5337
|
+
if (((_a = this.artboard) === null || _a === void 0 ? void 0 : _a.hasAudio) && this._audioEventListener === null) {
|
|
5338
|
+
this._audioEventListener = {
|
|
5330
5339
|
type: EventType.AudioStatusChange,
|
|
5331
5340
|
callback: function () { return _this.onSystemAudioChanged(); },
|
|
5332
|
-
}
|
|
5341
|
+
};
|
|
5342
|
+
audioManager.add(this._audioEventListener);
|
|
5333
5343
|
audioManager.establishAudio();
|
|
5334
5344
|
}
|
|
5335
5345
|
}
|
|
@@ -5519,12 +5529,14 @@ var Rive = /** @class */ (function () {
|
|
|
5519
5529
|
}
|
|
5520
5530
|
}
|
|
5521
5531
|
}
|
|
5522
|
-
stateMachine.
|
|
5532
|
+
stateMachine.advanceAndApply(elapsedTime);
|
|
5523
5533
|
// stateMachine.instance.apply(this.artboard);
|
|
5524
5534
|
}
|
|
5525
5535
|
// Once the animations have been applied to the artboard, advance it
|
|
5526
5536
|
// by the elapsed time.
|
|
5527
|
-
this.
|
|
5537
|
+
if (this.animator.stateMachines.length == 0) {
|
|
5538
|
+
this.artboard.advance(elapsedTime);
|
|
5539
|
+
}
|
|
5528
5540
|
var renderer = this.renderer;
|
|
5529
5541
|
// Canvas must be wiped to prevent artifacts
|
|
5530
5542
|
renderer.clear();
|
|
@@ -5623,6 +5635,10 @@ var Rive = /** @class */ (function () {
|
|
|
5623
5635
|
this.riveFile = null;
|
|
5624
5636
|
this.file = null;
|
|
5625
5637
|
this.deleteRiveRenderer();
|
|
5638
|
+
if (this._audioEventListener !== null) {
|
|
5639
|
+
audioManager.remove(this._audioEventListener);
|
|
5640
|
+
this._audioEventListener = null;
|
|
5641
|
+
}
|
|
5626
5642
|
};
|
|
5627
5643
|
/**
|
|
5628
5644
|
* Cleans up the Renderer object. Only call this API if you no longer
|