@rive-app/canvas-advanced-lite 2.9.2 → 2.10.0
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 +1 -1
- package/package.json +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +9 -0
package/canvas_advanced.mjs
CHANGED
|
@@ -32,7 +32,7 @@ K=Math.min(K,N);const wa=T-F,xa=K-H;console.assert(wa<=Math.min(sb,Y));console.a
|
|
|
32
32
|
ob:new Float32Array(z),indices:new Uint16Array(E),Rb:T,lb:p.Na<<1|(T?1:0)});O+=C.length;X+=E.length;var pa=this.ha,lc=b(w);this.ja.push(function(){pa.save();pa.resetTransform();pa.globalCompositeOperation=lc;pa.globalAlpha=B;const wb=fa.canvas();wb&&pa.drawImage(wb,ub,vb,ja,ka,F,H,wa,xa);pa.restore()})}},_clipPath:function(p){this.ja.push(this.ha.clip.bind(this.ha,p.pa,p.Ua===x?"evenodd":"nonzero"))},clear:function(){D.add(this);this.ja.push(this.ha.clearRect.bind(this.ha,0,0,this.Ta.width,this.Ta.height))},
|
|
33
33
|
flush:function(){},translate:function(p,w){this.transform(1,0,0,1,p,w)}});h.makeRenderer=function(p){const w=new ia(p),B=w.ha;return new Proxy(w,{get(C,z){if("function"===typeof C[z])return function(...E){return C[z].apply(C,E)};if("function"===typeof B[z]){if(-1<ea.indexOf(z))throw Error("RiveException: Method call to '"+z+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...E){w.ja.push(B[z].bind(B,
|
|
34
34
|
...E))}}return C[z]},set(C,z,E){if(z in B)return B[z]=E,!0}})};h.decodeImage=function(p,w){(new r({Aa:w})).decode(p)};h.renderFactory={makeRenderPaint:function(){return new G},makeRenderPath:function(){return new q},makeRenderImage:function(){let p=W;return new r({Fa:()=>{p.total++},Aa:()=>{p.loaded++;if(p.loaded===p.total){const w=p.ready;w&&(w(),p.ready=null)}}})}};let A=h.load,W=null;h.load=function(p,w,B=!0){const C=new h.FallbackFileAssetLoader;void 0!==w&&C.addLoader(w);B&&(w=new h.CDNFileAssetLoader,
|
|
35
|
-
C.addLoader(w));return new Promise(function(z){let E=null;W={total:0,loaded:0,ready:function(){z(E)}};E=A(p,C);0==W.total&&z(E)})};d=new ca;h.requestAnimationFrame=d.requestAnimationFrame.bind(d);h.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);h.enableFPSCounter=d.Db.bind(d);h.disableFPSCounter=d.Ab;d.hb=c;h.cleanup=function(){u&&u.delete()}};const la=h.onRuntimeInitialized;
|
|
35
|
+
C.addLoader(w));return new Promise(function(z){let E=null;W={total:0,loaded:0,ready:function(){z(E)}};E=A(p,C);0==W.total&&z(E)})};d=new ca;h.requestAnimationFrame=d.requestAnimationFrame.bind(d);h.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);h.enableFPSCounter=d.Db.bind(d);h.disableFPSCounter=d.Ab;d.hb=c;h.resolveAnimationFrame=c;h.cleanup=function(){u&&u.delete()}};const la=h.onRuntimeInitialized;
|
|
36
36
|
h.onRuntimeInitialized=function(){la&&la();let b=h.decodeFont;h.decodeFont=function(c,d){c=b(c);d(c)};const a=h.FileAssetLoader;h.ptrToAsset=c=>{let d=h.ptrToFileAsset(c);return d.isImage?h.ptrToImageAsset(c):d.isFont?h.ptrToFontAsset(c):d};h.CustomFileAssetLoader=a.extend("CustomFileAssetLoader",{__construct:function({loadContents:c}){this.__parent.__construct.call(this);this.rb=c},loadContents:function(c,d){c=h.ptrToAsset(c);return this.rb(c,d)}});h.CDNFileAssetLoader=a.extend("CDNFileAssetLoader",
|
|
37
37
|
{__construct:function(){this.__parent.__construct.call(this)},loadContents:function(c){let d=h.ptrToAsset(c);c=d.cdnUuid;if(""===c)return!1;(function(e,g){var m=new XMLHttpRequest;m.responseType="arraybuffer";m.onreadystatechange=function(){4==m.readyState&&200==m.status&&g(m)};m.open("GET",e,!0);m.send(null)})(d.cdnBaseUrl+"/"+c,e=>{d.decode(new Uint8Array(e.response))});return!0}});h.FallbackFileAssetLoader=a.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);
|
|
38
38
|
this.gb=[]},addLoader:function(c){this.gb.push(c)},loadContents:function(c,d){for(let e of this.gb)if(e.loadContents(c,d))return!0;return!1}})};var ma=Object.assign({},h),na="./this.program",oa="object"==typeof window,qa="function"==typeof importScripts,y="",ra,sa;
|
package/package.json
CHANGED
package/rive.wasm
CHANGED
|
Binary file
|
package/rive_advanced.mjs.d.ts
CHANGED
|
@@ -90,6 +90,15 @@ export interface RiveCanvas {
|
|
|
90
90
|
* @param requestID - ID of the requestAnimationFrame request to cancel
|
|
91
91
|
*/
|
|
92
92
|
cancelAnimationFrame(requestID: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* A Rive-specific function to "flush" queued up draw calls from using the renderer.
|
|
95
|
+
*
|
|
96
|
+
* This should only be invoked once at the end of a loop in a regular JS
|
|
97
|
+
* requestAnimationFrame loop, and should not be used with the Rive-wrapped
|
|
98
|
+
* requestAnimationFrame (aka, the requestAnimationFrame() API on this object) as that
|
|
99
|
+
* API will handle flushing the draw calls implicitly.
|
|
100
|
+
*/
|
|
101
|
+
resolveAnimationFrame(): void;
|
|
93
102
|
/**
|
|
94
103
|
* Debugging tool to showcase the FPS in the corner of the screen in a new div. If a callback
|
|
95
104
|
* function is provided, this function passes the FPS count to the callback instead of creating a
|