@rive-app/webgl2 2.49.1 → 2.49.3
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 +151 -10
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +5 -0
- package/rive_fallback.wasm +0 -0
- package/utils/index.d.ts +1 -0
- package/utils/replayPacer.d.ts +24 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -883,6 +883,7 @@ export declare class Rive {
|
|
|
883
883
|
private lastRenderTime;
|
|
884
884
|
private static batchStart;
|
|
885
885
|
private frameRequestId;
|
|
886
|
+
private replayPacer;
|
|
886
887
|
/**
|
|
887
888
|
* Used be draw to track when a second of active rendering time has passed.
|
|
888
889
|
* Used for debugging purposes
|
package/rive.js
CHANGED
|
@@ -793,14 +793,14 @@ return}switch(m){case 1:m=u;lb[g>>2]=m;lb[g+4>>2]=(m-lb[g>>2])/4294967296;break;
|
|
|
793
793
|
!1;return m},["delete"](){this.m.u||zc(this);if(this.m.la&&!this.m.ga)throw new Vb("Object already scheduled for deletion");nc(this);var m=this.m;--m.count.value;0===m.count.value&&(m.D?m.K.O(m.D):m.v.o.O(m.u));this.m.ga||(this.m.D=void 0,this.m.u=void 0)},isDeleted:function(){return!this.m.u},deleteLater:function(){this.m.u||zc(this);if(this.m.la&&!this.m.ga)throw new Vb("Object already scheduled for deletion");Ac.push(this);this.m.la=!0;return this}});const g=Symbol.dispose;g&&(d[g]=d["delete"])})();
|
|
794
794
|
Object.assign($c.prototype,{vc(d){this.Db&&(d=this.Db(d));return d},ob(d){this.O?.(d)},J:sc,s:function(d){function g(){return this.Ga?Zc(this.o.N,{v:this.Oc,u:m,K:this,D:d}):Zc(this.o.N,{v:this,u:d})}var m=this.vc(d);if(!m)return this.ob(d),null;var u=Yc(this.o,m);if(void 0!==u){if(0===u.m.count.value)return u.m.u=m,u.m.D=d,u.clone();u=u.clone();this.ob(d);return u}u=this.o.uc(m);u=Cc[u];if(!u)return g.call(this);u=this.Fa?u.jc:u.pointerType;var y=Xc(m,this.o,u.o);return null===y?g.call(this):this.Ga?
|
|
795
795
|
Zc(u.o.N,{v:u,u:y,K:this,D:d}):Zc(u.o.N,{v:u,u:y})}});for(let d=0;32>d;++d)se.push(Array(d));K.print&&(Va=K.print);K.printErr&&(Wa=K.printErr);K.wasmBinary&&(Xa=K.wasmBinary);K.thisProgram&&(Pa=K.thisProgram);if(K.preInit)for("function"==typeof K.preInit&&(K.preInit=[K.preInit]);0<K.preInit.length;)K.preInit.shift()();
|
|
796
|
-
var Ee={
|
|
796
|
+
var Ee={362116:(d,g,m,u,y)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=d;window.miniaudio.device_type.capture=g;window.miniaudio.device_type.duplex=m;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=u;window.miniaudio.device_state.started=y;let D=window.miniaudio;D.devices=
|
|
797
797
|
[];D.track_device=function(E){for(var F=0;F<D.devices.length;++F)if(null==D.devices[F])return D.devices[F]=E,F;D.devices.push(E);return D.devices.length-1};D.untrack_device_by_index=function(E){for(D.devices[E]=null;0<D.devices.length;)if(null==D.devices[D.devices.length-1])D.devices.pop();else break};D.untrack_device=function(E){for(var F=0;F<D.devices.length;++F)if(D.devices[F]==E)return D.untrack_device_by_index(F)};D.get_device_by_index=function(E){return D.devices[E]};D.unlock_event_types=["touchend",
|
|
798
|
-
"click"];D.unlock=function(){for(var E=0;E<D.devices.length;++E){var F=D.devices[E];null!=F&&null!=F.L&&F.state===D.device_state.started&&F.L.resume().then(()=>{Be(F.yb)},L=>{console.error("Failed to resume audiocontext",L)})}D.unlock_event_types.map(function(L){document.removeEventListener(L,D.unlock,!0)})};D.unlock_event_types.map(function(E){document.addEventListener(E,D.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},
|
|
799
|
-
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},
|
|
798
|
+
"click"];D.unlock=function(){for(var E=0;E<D.devices.length;++E){var F=D.devices[E];null!=F&&null!=F.L&&F.state===D.device_state.started&&F.L.resume().then(()=>{Be(F.yb)},L=>{console.error("Failed to resume audiocontext",L)})}D.unlock_event_types.map(function(L){document.removeEventListener(L,D.unlock,!0)})};D.unlock_event_types.map(function(E){document.addEventListener(E,D.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},364294:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(d){document.removeEventListener(d,
|
|
799
|
+
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},364598:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,364702:()=>{try{var d=new (window.AudioContext||window.webkitAudioContext),g=d.sampleRate;d.close();return g}catch(m){return 0}},364873:(d,g,m,u,y,D)=>{if("undefined"===typeof window.miniaudio)return-1;var E={},F={};d==window.miniaudio.device_type.playback&&0!=m&&(F.sampleRate=m);E.L=
|
|
800
800
|
new (window.AudioContext||window.webkitAudioContext)(F);E.L.suspend();E.state=window.miniaudio.device_state.stopped;m=0;d!=window.miniaudio.device_type.playback&&(m=g);E.U=E.L.createScriptProcessor(u,m,g);E.U.onaudioprocess=function(L){if(null==E.oa||0==E.oa.length||E.oa.buffer!==mb.buffer)E.oa=new Float32Array(mb.buffer,Number(y),u*g);if(d==window.miniaudio.device_type.capture||d==window.miniaudio.device_type.duplex){for(var P=0;P<g;P+=1)for(var T=L.inputBuffer.getChannelData(P),U=E.oa,W=0;W<u;W+=
|
|
801
801
|
1)U[W*g+P]=T[W];Ce(D,u,y)}if(d==window.miniaudio.device_type.playback||d==window.miniaudio.device_type.duplex)for(De(D,u,y),P=0;P<L.outputBuffer.numberOfChannels;++P)for(T=L.outputBuffer.getChannelData(P),U=E.oa,W=0;W<u;W+=1)T[W]=U[W*g+P];else for(P=0;P<L.outputBuffer.numberOfChannels;++P)L.outputBuffer.getChannelData(P).fill(0)};d!=window.miniaudio.device_type.capture&&d!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(L){E.Na=E.L.createMediaStreamSource(L);
|
|
802
|
-
E.Na.connect(E.U);E.U.connect(E.L.destination)}).catch(function(L){console.log("Failed to get user media: "+L)});d==window.miniaudio.device_type.playback&&E.U.connect(E.L.destination);E.yb=D;return window.miniaudio.track_device(E)},
|
|
803
|
-
|
|
802
|
+
E.Na.connect(E.U);E.U.connect(E.L.destination)}).catch(function(L){console.log("Failed to get user media: "+L)});d==window.miniaudio.device_type.playback&&E.U.connect(E.L.destination);E.yb=D;return window.miniaudio.track_device(E)},367817:d=>window.miniaudio.get_device_by_index(d).L.sampleRate,367890:d=>{d=window.miniaudio.get_device_by_index(d);void 0!==d.U&&(d.U.onaudioprocess=function(){},d.U.disconnect(),d.U=void 0);void 0!==d.Na&&(d.Na.disconnect(),d.Na=void 0);d.L.close();d.L=void 0;d.yb=void 0},
|
|
803
|
+
368290:d=>{window.miniaudio.untrack_device_by_index(d)},368340:d=>{d=window.miniaudio.get_device_by_index(d);d.L.resume();d.state=window.miniaudio.device_state.started},368479:d=>{d=window.miniaudio.get_device_by_index(d);d.L.suspend();d.state=window.miniaudio.device_state.stopped}},dc,ve,cc,Fe,Ge,He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Be,Ce,De,Qe,Re,Hb,ze,Jb,rb,cd,Te={__syscall_fcntl64:function(){return 0},__syscall_ioctl:function(){return 0},__syscall_openat:function(){},_abort_js:()=>sb(""),_embind_create_inheriting_constructor:(d,
|
|
804
804
|
g,m)=>{d=Zb(d);g=mc(g,"wrapper");m=Wb(m);var u=g.o,y=u.N,D=u.C.N,E=u.C.constructor;d=Sb(d,function(...F){for(var L of u.C.Ab)if(this[L]===D[L])throw new Yb(`Pure virtual function ${L} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:y});this.__construct(...F)});y.__construct=function(...F){if(this===y)throw new Vb("Pass correct 'this' to __construct");F=E.implement(this,...F);nc(F);var L=F.m;F.notifyOnDestruction();L.ga=!0;Object.defineProperties(this,{m:{value:L}});
|
|
805
805
|
pc(this);F=L.u;F=ac(u,F);if($b.hasOwnProperty(F))throw new Vb(`Tried to register registered instance: ${F}`);$b[F]=this};y.__destruct=function(){if(this===y)throw new Vb("Pass correct 'this' to __destruct");nc(this);var F=this.m.u;F=ac(u,F);if($b.hasOwnProperty(F))delete $b[F];else throw new Vb(`Tried to unregister unregistered instance: ${F}`);};d.prototype=Object.create(y);Object.assign(d.prototype,m);return Xb(d)},_embind_finalize_value_object:d=>{var g=qc[d];delete qc[d];var m=g.cb,u=g.O,y=g.qb,
|
|
806
806
|
D=y.map(E=>E.yc).concat(y.map(E=>E.Sj));xc([d],D,E=>{var F={},L,P;for([L,P]of y.entries()){const T=E[L],U=P.wc,W=P.xc,na=E[L+y.length],oa=P.Rj,wa=P.Tj;F[P.rc]={read:aa=>T.s(U(W,aa)),write:(aa,ca)=>{var ha=[];oa(wa,aa,na.B(ha,ca));rc(ha)},optional:T.optional}}return[{name:g.name,s:T=>{var U={},W;for(W in F)U[W]=F[W].read(T);u(T);return U},B:(T,U)=>{for(var W in F)if(!(W in U||F[W].optional))throw new TypeError(`Missing field: "${W}"`);var na=m();for(W in F)F[W].write(na,U[W]);null!==T&&T.push(u,na);
|
|
@@ -874,7 +874,7 @@ m.dynCall_iijii;bd.iiiji=m.dynCall_iiiji;bd.iiji=m.dynCall_iiji;bd.jii=m.dynCall
|
|
|
874
874
|
/***/ ((module) => {
|
|
875
875
|
|
|
876
876
|
"use strict";
|
|
877
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.49.
|
|
877
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.49.3","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_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
878
878
|
|
|
879
879
|
/***/ }),
|
|
880
880
|
/* 7 */
|
|
@@ -3026,6 +3026,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3026
3026
|
/* harmony export */ ImageAssetWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.ImageAssetWrapper),
|
|
3027
3027
|
/* harmony export */ ImageWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.ImageWrapper),
|
|
3028
3028
|
/* harmony export */ KeyboardInteractions: () => (/* reexport safe */ _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__.KeyboardInteractions),
|
|
3029
|
+
/* harmony export */ ReplayPacer: () => (/* reexport safe */ _replayPacer__WEBPACK_IMPORTED_MODULE_6__.ReplayPacer),
|
|
3029
3030
|
/* harmony export */ RiveFont: () => (/* reexport safe */ _riveFont__WEBPACK_IMPORTED_MODULE_5__.RiveFont),
|
|
3030
3031
|
/* harmony export */ createFinalization: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.createFinalization),
|
|
3031
3032
|
/* harmony export */ finalizationRegistry: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__.finalizationRegistry),
|
|
@@ -3038,6 +3039,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3038
3039
|
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20);
|
|
3039
3040
|
/* harmony import */ var _finalizationRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21);
|
|
3040
3041
|
/* harmony import */ var _riveFont__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22);
|
|
3042
|
+
/* harmony import */ var _replayPacer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23);
|
|
3043
|
+
|
|
3041
3044
|
|
|
3042
3045
|
|
|
3043
3046
|
|
|
@@ -5472,6 +5475,138 @@ var RiveFont = /** @class */ (function () {
|
|
|
5472
5475
|
|
|
5473
5476
|
|
|
5474
5477
|
|
|
5478
|
+
/***/ }),
|
|
5479
|
+
/* 23 */
|
|
5480
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5481
|
+
|
|
5482
|
+
"use strict";
|
|
5483
|
+
__webpack_require__.r(__webpack_exports__);
|
|
5484
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5485
|
+
/* harmony export */ ReplayPacer: () => (/* binding */ ReplayPacer)
|
|
5486
|
+
/* harmony export */ });
|
|
5487
|
+
var kRefreshSamples = 15;
|
|
5488
|
+
// The frames the worker's replay time averages over, plus the three still in
|
|
5489
|
+
// flight when the cadence changes.
|
|
5490
|
+
var kSettleFrames = 12;
|
|
5491
|
+
var kProbeAfterMs = 1000;
|
|
5492
|
+
var kMaxProbeAfterMs = 16000;
|
|
5493
|
+
// A worker only slightly slower than its cadence fills its queue now and then,
|
|
5494
|
+
// a worker that keeps up almost never.
|
|
5495
|
+
var kBackupWindow = 60;
|
|
5496
|
+
var kSaturatedBackups = 3;
|
|
5497
|
+
var median = function (values) {
|
|
5498
|
+
var sorted = values.slice().sort(function (a, b) { return a - b; });
|
|
5499
|
+
return sorted[sorted.length >> 1];
|
|
5500
|
+
};
|
|
5501
|
+
/**
|
|
5502
|
+
* Paces recording to a replay worker slower than the display. Recording as
|
|
5503
|
+
* soon as its queue frees sends frames in bursts, so instead they go out every
|
|
5504
|
+
* N refreshes, with N following the worker's recent replay time.
|
|
5505
|
+
*/
|
|
5506
|
+
var ReplayPacer = /** @class */ (function () {
|
|
5507
|
+
function ReplayPacer() {
|
|
5508
|
+
this.lastTime = 0;
|
|
5509
|
+
this.lastRecord = 0;
|
|
5510
|
+
this.intervals = [];
|
|
5511
|
+
this.divisor = 1;
|
|
5512
|
+
// Frames recorded since the divisor changed, which the replay time still
|
|
5513
|
+
// averages in.
|
|
5514
|
+
this.settle = 0;
|
|
5515
|
+
this.nextProbe = 0;
|
|
5516
|
+
this.probing = false;
|
|
5517
|
+
// Failed probes back off, since each one costs a few uneven frames.
|
|
5518
|
+
this.probeAfter = kProbeAfterMs;
|
|
5519
|
+
// Whether the worker's queue filled since the last decision.
|
|
5520
|
+
this.backedUp = false;
|
|
5521
|
+
this.recentBackups = [];
|
|
5522
|
+
}
|
|
5523
|
+
/**
|
|
5524
|
+
* Called on every animation frame. Returns whether this one should record,
|
|
5525
|
+
* given the worker's replay time and whether its queue has room.
|
|
5526
|
+
*/
|
|
5527
|
+
ReplayPacer.prototype.shouldRecord = function (time, replayMs, accepts) {
|
|
5528
|
+
if (this.lastTime && time > this.lastTime) {
|
|
5529
|
+
this.intervals.push(time - this.lastTime);
|
|
5530
|
+
if (this.intervals.length > kRefreshSamples) {
|
|
5531
|
+
this.intervals.shift();
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
this.lastTime = time;
|
|
5535
|
+
if (!accepts) {
|
|
5536
|
+
// A canvas the worker has yet to take refuses frames too.
|
|
5537
|
+
if (replayMs > 0) {
|
|
5538
|
+
this.backedUp = true;
|
|
5539
|
+
}
|
|
5540
|
+
return false;
|
|
5541
|
+
}
|
|
5542
|
+
if (replayMs > 0 && this.intervals.length > 0) {
|
|
5543
|
+
var refresh = median(this.intervals);
|
|
5544
|
+
if (this.settle === 0) {
|
|
5545
|
+
this.adapt(time, replayMs / refresh);
|
|
5546
|
+
}
|
|
5547
|
+
if (this.divisor > 1 &&
|
|
5548
|
+
time - this.lastRecord < (this.divisor - 0.5) * refresh) {
|
|
5549
|
+
return false;
|
|
5550
|
+
}
|
|
5551
|
+
}
|
|
5552
|
+
this.lastRecord = time;
|
|
5553
|
+
this.settle = Math.max(0, this.settle - 1);
|
|
5554
|
+
return true;
|
|
5555
|
+
};
|
|
5556
|
+
ReplayPacer.prototype.adapt = function (time, ratio) {
|
|
5557
|
+
var divisor = this.divisor;
|
|
5558
|
+
var backedUp = this.backedUp;
|
|
5559
|
+
this.backedUp = false;
|
|
5560
|
+
this.recentBackups.push(backedUp);
|
|
5561
|
+
if (this.recentBackups.length > kBackupWindow) {
|
|
5562
|
+
this.recentBackups.shift();
|
|
5563
|
+
}
|
|
5564
|
+
var saturated = this.recentBackups.filter(Boolean).length >= kSaturatedBackups;
|
|
5565
|
+
var lagging = ratio > divisor * 1.1;
|
|
5566
|
+
// A worker that keeps up never fills its queue, however long each frame
|
|
5567
|
+
// takes to finish, so only a lag with a full queue slows the cadence. A
|
|
5568
|
+
// probe fails on either, since it settled at the new cadence.
|
|
5569
|
+
if (this.probing
|
|
5570
|
+
? lagging || backedUp
|
|
5571
|
+
: (lagging && backedUp) || (ratio > divisor && saturated)) {
|
|
5572
|
+
this.probeAfter = this.probing
|
|
5573
|
+
? Math.min(this.probeAfter * 2, kMaxProbeAfterMs)
|
|
5574
|
+
: kProbeAfterMs;
|
|
5575
|
+
this.setDivisor(time, Math.max(divisor + 1, Math.ceil(ratio)));
|
|
5576
|
+
}
|
|
5577
|
+
else if (ratio < (divisor - 1) * 0.9) {
|
|
5578
|
+
// Paced frames no longer overlap, so their replay time is a ceiling
|
|
5579
|
+
// and a faster cadence under it is safe.
|
|
5580
|
+
this.probeAfter = kProbeAfterMs;
|
|
5581
|
+
this.setDivisor(time, Math.max(1, Math.ceil(ratio / 0.9)));
|
|
5582
|
+
}
|
|
5583
|
+
else if (this.probing) {
|
|
5584
|
+
// A worker only slightly too slow takes a while to fill its queue.
|
|
5585
|
+
if (this.recentBackups.length >= kBackupWindow) {
|
|
5586
|
+
this.probing = false;
|
|
5587
|
+
this.probeAfter = kProbeAfterMs;
|
|
5588
|
+
}
|
|
5589
|
+
}
|
|
5590
|
+
else if (divisor > 1 && time >= this.nextProbe) {
|
|
5591
|
+
// Frames that overlap on the GPU can keep up with a cadence shorter
|
|
5592
|
+
// than one frame's replay, which only trying it shows.
|
|
5593
|
+
this.setDivisor(time, divisor - 1);
|
|
5594
|
+
this.probing = true;
|
|
5595
|
+
}
|
|
5596
|
+
};
|
|
5597
|
+
ReplayPacer.prototype.setDivisor = function (time, divisor) {
|
|
5598
|
+
this.divisor = divisor;
|
|
5599
|
+
this.settle = kSettleFrames;
|
|
5600
|
+
this.probing = false;
|
|
5601
|
+
this.backedUp = false;
|
|
5602
|
+
this.recentBackups = [];
|
|
5603
|
+
this.nextProbe = time + this.probeAfter;
|
|
5604
|
+
};
|
|
5605
|
+
return ReplayPacer;
|
|
5606
|
+
}());
|
|
5607
|
+
|
|
5608
|
+
|
|
5609
|
+
|
|
5475
5610
|
/***/ })
|
|
5476
5611
|
/******/ ]);
|
|
5477
5612
|
/************************************************************************/
|
|
@@ -7551,6 +7686,7 @@ var Rive = /** @class */ (function () {
|
|
|
7551
7686
|
this.lastRenderTime = 0;
|
|
7552
7687
|
// Tracks the current animation frame request
|
|
7553
7688
|
this.frameRequestId = null;
|
|
7689
|
+
this.replayPacer = new _utils__WEBPACK_IMPORTED_MODULE_3__.ReplayPacer();
|
|
7554
7690
|
/**
|
|
7555
7691
|
* Used be draw to track when a second of active rendering time has passed.
|
|
7556
7692
|
* Used for debugging purposes
|
|
@@ -8630,7 +8766,7 @@ var Rive = /** @class */ (function () {
|
|
|
8630
8766
|
* @param time the rAF timestamp, or null to draw now without advancing
|
|
8631
8767
|
*/
|
|
8632
8768
|
Rive.prototype.draw = function (time, onSecond) {
|
|
8633
|
-
var _a, _b, _c, _d;
|
|
8769
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8634
8770
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
8635
8771
|
this.frameRequestId = null;
|
|
8636
8772
|
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
@@ -8644,10 +8780,15 @@ var Rive = /** @class */ (function () {
|
|
|
8644
8780
|
this.reloadForRestoredContext();
|
|
8645
8781
|
return;
|
|
8646
8782
|
}
|
|
8647
|
-
// The replay worker has yet to take the canvas,
|
|
8648
|
-
// frames
|
|
8783
|
+
// The replay worker has yet to take the canvas, is still on earlier
|
|
8784
|
+
// frames, or is slower than the display and this frame falls between its
|
|
8785
|
+
// paced ones. Waiting keeps its queue bounded, and the frame that follows
|
|
8649
8786
|
// advances by the whole wait, so playback keeps time.
|
|
8650
|
-
|
|
8787
|
+
var accepts = ((_d = (_c = this.renderer) === null || _c === void 0 ? void 0 : _c.acceptsFrame) === null || _d === void 0 ? void 0 : _d.call(_c)) !== false;
|
|
8788
|
+
var replayMs = (_f = (_e = this.renderer) === null || _e === void 0 ? void 0 : _e.replayMs) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
8789
|
+
if (time !== null && replayMs !== undefined
|
|
8790
|
+
? !this.replayPacer.shouldRecord(time, replayMs, accepts)
|
|
8791
|
+
: !accepts) {
|
|
8651
8792
|
this.scheduleRendering();
|
|
8652
8793
|
return;
|
|
8653
8794
|
}
|