@rive-app/canvas-single 1.0.73 → 1.0.76

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/rive.js +11 -8
  3. package/rive.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/canvas-single",
3
- "version": "1.0.73",
3
+ "version": "1.0.76",
4
4
  "description": "Rive's high-level canvas based web api all in one js file.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.js CHANGED
@@ -29,8 +29,8 @@ function(Rive) {
29
29
 
30
30
 
31
31
  null;var k;k||(k=typeof Rive !== 'undefined' ? Rive : {});var aa,ba;k.ready=new Promise(function(b,a){aa=b;ba=a});
32
- function ca(){function b(n){const g=d;c=a=0;d=new Map;g.forEach(m=>{try{m(n)}catch(h){console.error(h)}});this.Pa();e&&e.ib()}let a=0,c=0,d=new Map,e=null,f=null;this.requestAnimationFrame=function(n){a||(a=window.requestAnimationFrame(b.bind(this)));const g=++c;d.set(g,n);return g};this.cancelAnimationFrame=function(n){d.delete(n);a&&0==d.size&&(window.cancelAnimationFrame(a),a=0)};this.gb=function(n){f&&(document.body.remove(f),f=null);n||(f=document.createElement("div"),f.style.backgroundColor=
33
- "black",f.style.position="fixed",f.style.right=0,f.style.top=0,f.style.color="white",f.style.padding="4px",f.innerHTML="RIVE FPS",n=function(g){f.innerHTML="RIVE FPS "+g.toFixed(1)},document.body.appendChild(f));e=new function(){let g=0,m=0;this.ib=function(){var h=performance.now();m?(++g,h-=m,1E3<h&&(n(1E3*g/h),g=m=0)):(m=h,g=0)}}};this.cb=function(){f&&(document.body.remove(f),f=null);e=null};this.Pa=function(){}}
32
+ function ca(){function b(n){const g=d;c=a=0;d=new Map;g.forEach(m=>{try{m(n)}catch(h){console.error(h)}});this.Pa();e&&e.ib()}let a=0,c=0,d=new Map,e=null,f=null;this.requestAnimationFrame=function(n){a||(a=requestAnimationFrame(b.bind(this)));const g=++c;d.set(g,n);return g};this.cancelAnimationFrame=function(n){d.delete(n);a&&0==d.size&&(cancelAnimationFrame(a),a=0)};this.gb=function(n){f&&(document.body.remove(f),f=null);n||(f=document.createElement("div"),f.style.backgroundColor="black",f.style.position=
33
+ "fixed",f.style.right=0,f.style.top=0,f.style.color="white",f.style.padding="4px",f.innerHTML="RIVE FPS",n=function(g){f.innerHTML="RIVE FPS "+g.toFixed(1)},document.body.appendChild(f));e=new function(){let g=0,m=0;this.ib=function(){var h=performance.now();m?(++g,h-=m,1E3<h&&(n(1E3*g/h),g=m=0)):(m=h,g=0)}}};this.cb=function(){f&&(document.body.remove(f),f=null);e=null};this.Pa=function(){}}
34
34
  function da(b){console.assert(!0);const a=new Map;let c=-Infinity;this.push=function(d){d=d+((1<<b)-1)>>b;a.has(d)&&clearTimeout(a.get(d));a.set(d,setTimeout(function(){a.delete(d);0==a.length?c=-Infinity:d==c&&(c=Math.max(...a.keys()),console.assert(c<d))},1E3));c=Math.max(d,c);return c<<b}}
35
35
  const fa=new function(){function b(){if(!a){var t=document.createElement("canvas"),x={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,preferLowPowerToHighPerformance:0,failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,renderViaOffscreenBackBuffer:1};let q=t.getContext("webgl2",x);if(q)c=2;else if(q=t.getContext("webgl",x))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;d=Math.min(q.getParameter(q.MAX_RENDERBUFFER_SIZE),
36
36
  q.getParameter(q.MAX_TEXTURE_SIZE));function F(G,v,A){v=q.createShader(v);q.shaderSource(v,A);q.compileShader(v);A=q.getShaderInfoLog(v);if(0<A.length)throw A;q.attachShader(G,v)}t=q.createProgram();F(t,q.VERTEX_SHADER,"attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }");
@@ -141,7 +141,7 @@ k.run=Fc;if(k.preInit)for("function"==typeof k.preInit&&(k.preInit=[k.preInit]);
141
141
  /* 2 */
142
142
  /***/ ((module) => {
143
143
 
144
- module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"1.0.73","description":"Rive\'s high-level canvas based web api all in one js file.","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
144
+ module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"1.0.76","description":"Rive\'s high-level canvas based web api all in one js file.","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
145
145
 
146
146
  /***/ }),
147
147
  /* 3 */
@@ -1516,8 +1516,12 @@ var Rive = /** @class */ (function () {
1516
1516
  if (this.eventCleanup !== null) {
1517
1517
  this.eventCleanup();
1518
1518
  }
1519
- this.artboard.delete();
1520
- // TODO: delete animation and state machine instances
1519
+ // Delete all animation and state machine instances
1520
+ this.stop();
1521
+ if (this.artboard) {
1522
+ this.artboard.delete();
1523
+ this.artboard = null;
1524
+ }
1521
1525
  };
1522
1526
  // Plays specified animations; if none specified, it unpauses everything.
1523
1527
  Rive.prototype.play = function (animationNames, autoplay) {
@@ -1590,7 +1594,6 @@ var Rive = /** @class */ (function () {
1590
1594
  var stateMachineNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.stateMachines);
1591
1595
  var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;
1592
1596
  // Stop everything and clean up
1593
- this.stop();
1594
1597
  this.cleanup();
1595
1598
  // Reinitialize an artboard instance with the state
1596
1599
  this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay);
@@ -1667,7 +1670,7 @@ var Rive = /** @class */ (function () {
1667
1670
  * Returns the name of the active artboard
1668
1671
  */
1669
1672
  get: function () {
1670
- return this.artboard.name;
1673
+ return this.artboard ? this.artboard.name : "";
1671
1674
  },
1672
1675
  enumerable: false,
1673
1676
  configurable: true
@@ -1873,7 +1876,7 @@ var Rive = /** @class */ (function () {
1873
1876
  * renderer is already active, then this will have zero effect.
1874
1877
  */
1875
1878
  Rive.prototype.startRendering = function () {
1876
- if (this.loaded && !this.frameRequestId) {
1879
+ if (this.loaded && this.artboard && !this.frameRequestId) {
1877
1880
  if (this.runtime.requestAnimationFrame) {
1878
1881
  this.frameRequestId = this.runtime.requestAnimationFrame(this.draw.bind(this));
1879
1882
  }