@eva/plugin-renderer-sprite-animation 1.1.1-alpha.0 → 1.1.1-fix.1

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 (51) hide show
  1. package/README.md +1 -2
  2. package/dist/plugin-renderer-sprite-animation.cjs.js +9 -10
  3. package/dist/plugin-renderer-sprite-animation.cjs.prod.js +1 -1
  4. package/dist/plugin-renderer-sprite-animation.esm.js +10 -11
  5. package/index.js +3 -3
  6. package/package.json +4 -4
  7. package/dist/EVA.plugin.renderer.spriteAnimation.js +0 -362
  8. package/dist/EVA.plugin.renderer.spriteAnimation.min.js +0 -1
  9. package/dist/examples/index.d.ts +0 -2
  10. package/dist/examples/index.d.ts.map +0 -1
  11. package/dist/examples/src/a11y.d.ts +0 -3
  12. package/dist/examples/src/a11y.d.ts.map +0 -1
  13. package/dist/examples/src/component.d.ts +0 -3
  14. package/dist/examples/src/component.d.ts.map +0 -1
  15. package/dist/examples/src/compressed-texture.d.ts +0 -1
  16. package/dist/examples/src/compressed-texture.d.ts.map +0 -1
  17. package/dist/examples/src/dragonbone.d.ts +0 -3
  18. package/dist/examples/src/dragonbone.d.ts.map +0 -1
  19. package/dist/examples/src/event.d.ts +0 -3
  20. package/dist/examples/src/event.d.ts.map +0 -1
  21. package/dist/examples/src/graphics.d.ts +0 -3
  22. package/dist/examples/src/graphics.d.ts.map +0 -1
  23. package/dist/examples/src/image.d.ts +0 -3
  24. package/dist/examples/src/image.d.ts.map +0 -1
  25. package/dist/examples/src/loader.d.ts +0 -3
  26. package/dist/examples/src/loader.d.ts.map +0 -1
  27. package/dist/examples/src/lottie.d.ts +0 -3
  28. package/dist/examples/src/lottie.d.ts.map +0 -1
  29. package/dist/examples/src/mask.d.ts +0 -4
  30. package/dist/examples/src/mask.d.ts.map +0 -1
  31. package/dist/examples/src/matter.d.ts +0 -3
  32. package/dist/examples/src/matter.d.ts.map +0 -1
  33. package/dist/examples/src/multi-canvas.d.ts +0 -3
  34. package/dist/examples/src/multi-canvas.d.ts.map +0 -1
  35. package/dist/examples/src/ninePatch.d.ts +0 -3
  36. package/dist/examples/src/ninePatch.d.ts.map +0 -1
  37. package/dist/examples/src/sound.d.ts +0 -3
  38. package/dist/examples/src/sound.d.ts.map +0 -1
  39. package/dist/examples/src/spine.d.ts +0 -3
  40. package/dist/examples/src/spine.d.ts.map +0 -1
  41. package/dist/examples/src/sprite.d.ts +0 -3
  42. package/dist/examples/src/sprite.d.ts.map +0 -1
  43. package/dist/examples/src/spriteAnimation.d.ts +0 -3
  44. package/dist/examples/src/spriteAnimation.d.ts.map +0 -1
  45. package/dist/examples/src/text.d.ts +0 -3
  46. package/dist/examples/src/text.d.ts.map +0 -1
  47. package/dist/examples/src/tilingSprite.d.ts +0 -3
  48. package/dist/examples/src/tilingSprite.d.ts.map +0 -1
  49. package/dist/examples/src/transition.d.ts +0 -3
  50. package/dist/examples/src/transition.d.ts.map +0 -1
  51. package/dist/plugin-renderer-sprite-animation.d.ts +0 -63
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
-
2
1
  # @eva/plugin-renderer-sprite-animation
3
2
 
4
3
  More Introduction
4
+
5
5
  - [EN](https://eva.js.org)
6
6
  - [中文](https://eva-engine.gitee.io)
7
-
@@ -91,7 +91,7 @@ function __values(o) {
91
91
  };
92
92
  }
93
93
 
94
- var SpriteAnimation$1 = (function (_super) {
94
+ var SpriteAnimation$2 = (function (_super) {
95
95
  __extends(SpriteAnimation, _super);
96
96
  function SpriteAnimation() {
97
97
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -171,7 +171,8 @@ var SpriteAnimation$1 = (function (_super) {
171
171
  eva_js.decorators.IDEProp
172
172
  ], SpriteAnimation.prototype, "speed", void 0);
173
173
  return SpriteAnimation;
174
- }(eva_js.Component));
174
+ }(eva_js.Component));
175
+ var SpriteAnimation$3 = SpriteAnimation$2;
175
176
 
176
177
  var resourceKeySplit = '_s|r|c_';
177
178
  eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.SPRITE_ANIMATION, function (_a) {
@@ -283,8 +284,7 @@ var SpriteAnimation = (function (_super) {
283
284
  case 2:
284
285
  if (!(changed.type === eva_js.OBSERVER_TYPE.CHANGE)) return [3, 6];
285
286
  if (!(changed.prop && changed.prop.prop[0] === 'speed')) return [3, 3];
286
- this.animates[changed.gameObject.id].speed =
287
- 1000 / 60 / component.speed;
287
+ this.animates[changed.gameObject.id].speed = 1000 / 60 / component.speed;
288
288
  return [3, 5];
289
289
  case 3: return [4, eva_js.resource.getResource(component.resource)];
290
290
  case 4:
@@ -313,9 +313,7 @@ var SpriteAnimation = (function (_super) {
313
313
  var frames = _a.frames, id = _a.id, component = _a.component;
314
314
  var animate = new rendererAdapter.SpriteAnimation({ frames: frames });
315
315
  this.animates[id] = animate;
316
- this.containerManager
317
- .getContainer(id)
318
- .addChildAt(animate.animatedSprite, 0);
316
+ this.containerManager.getContainer(id).addChildAt(animate.animatedSprite, 0);
319
317
  animate.animatedSprite.onComplete = function () {
320
318
  component.emit('complete');
321
319
  };
@@ -353,7 +351,8 @@ var SpriteAnimation = (function (_super) {
353
351
  })
354
352
  ], SpriteAnimation);
355
353
  return SpriteAnimation;
356
- }(pluginRenderer.Renderer));
354
+ }(pluginRenderer.Renderer));
355
+ var SpriteAnimation$1 = SpriteAnimation;
357
356
 
358
- exports.SpriteAnimation = SpriteAnimation$1;
359
- exports.SpriteAnimationSystem = SpriteAnimation;
357
+ exports.SpriteAnimation = SpriteAnimation$3;
358
+ exports.SpriteAnimationSystem = SpriteAnimation$1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),n=require("pixi.js"),o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function s(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function c(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}var p=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e.autoPlay=!0,e.speed=100,e.waitPlay=!1,e.waitStop=!1,e.times=1/0,e.count=0,e}return i(r,t),r.prototype.init=function(e){var t=this;e&&Object.assign(this,e),this.on("loop",(function(){++t.count>=t.times&&(t.animate.stop(),t.emit("complete"))}))},r.prototype.play=function(e){void 0===e&&(e=1/0),0!==e&&(this.times=e,this.animate?(this.animate.play(),this.count=0):this.waitPlay=!0)},r.prototype.stop=function(){this.animate?this.animate.stop():this.waitStop=!0},Object.defineProperty(r.prototype,"animate",{get:function(){return this._animate},set:function(e){this._animate=e,this.waitPlay&&(this.waitPlay=!1,this.play(this.times)),this.waitStop&&(this.waitStop=!1,this.stop())},enumerable:!1,configurable:!0}),r.prototype.gotoAndPlay=function(e){this.animate.gotoAndPlay(e)},r.prototype.gotoAndStop=function(e){this.animate.gotoAndStop(e)},r.componentName="SpriteAnimation",a([e.decorators.IDEProp],r.prototype,"resource",void 0),a([e.decorators.IDEProp],r.prototype,"autoPlay",void 0),a([e.decorators.IDEProp],r.prototype,"speed",void 0),r}(e.Component);e.resource.registerInstance(e.RESOURCE_TYPE.SPRITE_ANIMATION,(function(e){var t=e.name,r=e.data;return new Promise((function(e){var o,i,a=r.json,s=n.BaseTexture.from(r.image),p=a.frames||{},u=a.animations||{},l={};for(var m in p){l[t+"_s|r|c_"+m]=p[m]}for(var m in u){var f=[];if(u[m]&&u[m].length>=0)try{for(var d=(o=void 0,c(u[m])),h=d.next();!h.done;h=d.next()){var y=h.value,v=t+"_s|r|c_"+y;f.push(v)}}catch(e){o={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}u[m]=f}a.frames=l;var g=new n.Spritesheet(s,a);g.parse((function(){var t=g.textures,r=[];for(var n in t)r.push(t[n]);e(r)}))}))})),e.resource.registerDestroy(e.RESOURCE_TYPE.SPRITE_ANIMATION,(function(e){var t,r,n=e.instance;if(n)try{for(var o=c(n),i=o.next();!i.done;i=o.next()){i.value.destroy(!0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}));var u=function(n){function o(){var e=null!==n&&n.apply(this,arguments)||this;return e.name="SpriteAnimation",e.animates={},e.autoPlay={},e}return i(o,n),o.prototype.init=function(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.animates[e.id]&&(this.animates[e.id].animatedSprite.width=r,this.animates[e.id].animatedSprite.height=n)},o.prototype.componentChanged=function(t){return r=this,n=void 0,i=function(){var r,n,o;return s(this,(function(i){switch(i.label){case 0:return"SpriteAnimation"!==t.componentName?[3,7]:(r=t.component,this.autoPlay[t.gameObject.id]=r.autoPlay,t.type!==e.OBSERVER_TYPE.ADD?[3,2]:[4,e.resource.getResource(r.resource)]);case 1:return(n=i.sent().instance)||console.error("GameObject:"+t.gameObject.name+"'s Img resource load error"),this.add({frames:n,id:t.gameObject.id,component:r}),[3,7];case 2:return t.type!==e.OBSERVER_TYPE.CHANGE?[3,6]:t.prop&&"speed"===t.prop.prop[0]?(this.animates[t.gameObject.id].speed=1e3/60/r.speed,[3,5]):[3,3];case 3:return[4,e.resource.getResource(r.resource)];case 4:(o=i.sent().instance)||console.error("GameObject:"+t.gameObject.name+"'s Img resource load error"),this.change({frames:o,id:t.gameObject.id,component:r}),i.label=5;case 5:return[3,7];case 6:t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t.gameObject.id),i.label=7;case 7:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,t){function a(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(a,s)}c((i=i.apply(r,n||[])).next())}));var r,n,o,i},o.prototype.add=function(e){var t=e.frames,n=e.id,o=e.component,i=new r.SpriteAnimation({frames:t});this.animates[n]=i,this.containerManager.getContainer(n).addChildAt(i.animatedSprite,0),i.animatedSprite.onComplete=function(){o.emit("complete")},i.animatedSprite.onFrameChange=function(){o.emit("frameChange")},i.animatedSprite.onLoop=function(){o.emit("loop")},o.animate=this.animates[n],this.animates[n].speed=1e3/60/o.speed,this.autoPlay[n]&&i.animatedSprite.play()},o.prototype.change=function(e){var t=e.frames,r=e.id,n=e.component;this.remove(r,!0),this.add({frames:t,id:r,component:n})},o.prototype.remove=function(e,t){var r=this.animates[e];this.autoPlay[e]=r.animatedSprite.playing,this.containerManager.getContainer(e).removeChild(r.animatedSprite),r.animatedSprite.destroy({children:!0}),delete this.animates[e],t||delete this.autoPlay[e]},o.systemName="SpriteAnimation",o=a([e.decorators.componentObserver({SpriteAnimation:["speed","resource"]})],o)}(t.Renderer);exports.SpriteAnimation=p,exports.SpriteAnimationSystem=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),n=require("pixi.js"),o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},o(e,t)};function i(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function s(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function c(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}var p=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e.autoPlay=!0,e.speed=100,e.waitPlay=!1,e.waitStop=!1,e.times=1/0,e.count=0,e}return i(r,t),r.prototype.init=function(e){var t=this;e&&Object.assign(this,e),this.on("loop",(function(){++t.count>=t.times&&(t.animate.stop(),t.emit("complete"))}))},r.prototype.play=function(e){void 0===e&&(e=1/0),0!==e&&(this.times=e,this.animate?(this.animate.play(),this.count=0):this.waitPlay=!0)},r.prototype.stop=function(){this.animate?this.animate.stop():this.waitStop=!0},Object.defineProperty(r.prototype,"animate",{get:function(){return this._animate},set:function(e){this._animate=e,this.waitPlay&&(this.waitPlay=!1,this.play(this.times)),this.waitStop&&(this.waitStop=!1,this.stop())},enumerable:!1,configurable:!0}),r.prototype.gotoAndPlay=function(e){this.animate.gotoAndPlay(e)},r.prototype.gotoAndStop=function(e){this.animate.gotoAndStop(e)},r.componentName="SpriteAnimation",a([e.decorators.IDEProp],r.prototype,"resource",void 0),a([e.decorators.IDEProp],r.prototype,"autoPlay",void 0),a([e.decorators.IDEProp],r.prototype,"speed",void 0),r}(e.Component),u=p;e.resource.registerInstance(e.RESOURCE_TYPE.SPRITE_ANIMATION,(function(e){var t=e.name,r=e.data;return new Promise((function(e){var o,i,a=r.json,s=n.BaseTexture.from(r.image),p=a.frames||{},u=a.animations||{},l={};for(var m in p){l[t+"_s|r|c_"+m]=p[m]}for(var m in u){var f=[];if(u[m]&&u[m].length>=0)try{for(var d=(o=void 0,c(u[m])),h=d.next();!h.done;h=d.next()){var y=h.value,v=t+"_s|r|c_"+y;f.push(v)}}catch(e){o={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}u[m]=f}a.frames=l;var g=new n.Spritesheet(s,a);g.parse((function(){var t=g.textures,r=[];for(var n in t)r.push(t[n]);e(r)}))}))})),e.resource.registerDestroy(e.RESOURCE_TYPE.SPRITE_ANIMATION,(function(e){var t,r,n=e.instance;if(n)try{for(var o=c(n),i=o.next();!i.done;i=o.next()){i.value.destroy(!0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}));var l=function(n){function o(){var e=null!==n&&n.apply(this,arguments)||this;return e.name="SpriteAnimation",e.animates={},e.autoPlay={},e}return i(o,n),o.prototype.init=function(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.animates[e.id]&&(this.animates[e.id].animatedSprite.width=r,this.animates[e.id].animatedSprite.height=n)},o.prototype.componentChanged=function(t){return r=this,n=void 0,i=function(){var r,n,o;return s(this,(function(i){switch(i.label){case 0:return"SpriteAnimation"!==t.componentName?[3,7]:(r=t.component,this.autoPlay[t.gameObject.id]=r.autoPlay,t.type!==e.OBSERVER_TYPE.ADD?[3,2]:[4,e.resource.getResource(r.resource)]);case 1:return(n=i.sent().instance)||console.error("GameObject:"+t.gameObject.name+"'s Img resource load error"),this.add({frames:n,id:t.gameObject.id,component:r}),[3,7];case 2:return t.type!==e.OBSERVER_TYPE.CHANGE?[3,6]:t.prop&&"speed"===t.prop.prop[0]?(this.animates[t.gameObject.id].speed=1e3/60/r.speed,[3,5]):[3,3];case 3:return[4,e.resource.getResource(r.resource)];case 4:(o=i.sent().instance)||console.error("GameObject:"+t.gameObject.name+"'s Img resource load error"),this.change({frames:o,id:t.gameObject.id,component:r}),i.label=5;case 5:return[3,7];case 6:t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t.gameObject.id),i.label=7;case 7:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,t){function a(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(a,s)}c((i=i.apply(r,n||[])).next())}));var r,n,o,i},o.prototype.add=function(e){var t=e.frames,n=e.id,o=e.component,i=new r.SpriteAnimation({frames:t});this.animates[n]=i,this.containerManager.getContainer(n).addChildAt(i.animatedSprite,0),i.animatedSprite.onComplete=function(){o.emit("complete")},i.animatedSprite.onFrameChange=function(){o.emit("frameChange")},i.animatedSprite.onLoop=function(){o.emit("loop")},o.animate=this.animates[n],this.animates[n].speed=1e3/60/o.speed,this.autoPlay[n]&&i.animatedSprite.play()},o.prototype.change=function(e){var t=e.frames,r=e.id,n=e.component;this.remove(r,!0),this.add({frames:t,id:r,component:n})},o.prototype.remove=function(e,t){var r=this.animates[e];this.autoPlay[e]=r.animatedSprite.playing,this.containerManager.getContainer(e).removeChild(r.animatedSprite),r.animatedSprite.destroy({children:!0}),delete this.animates[e],t||delete this.autoPlay[e]},o.systemName="SpriteAnimation",o=a([e.decorators.componentObserver({SpriteAnimation:["speed","resource"]})],o)}(t.Renderer);exports.SpriteAnimation=u,exports.SpriteAnimationSystem=l;
@@ -1,6 +1,6 @@
1
1
  import { decorators, Component, resource, RESOURCE_TYPE, OBSERVER_TYPE } from '@eva/eva.js';
2
2
  import { RendererSystem, Renderer } from '@eva/plugin-renderer';
3
- import { SpriteAnimation as SpriteAnimation$2 } from '@eva/renderer-adapter';
3
+ import { SpriteAnimation as SpriteAnimation$4 } from '@eva/renderer-adapter';
4
4
  import { BaseTexture, Spritesheet } from 'pixi.js';
5
5
 
6
6
  /*! *****************************************************************************
@@ -87,7 +87,7 @@ function __values(o) {
87
87
  };
88
88
  }
89
89
 
90
- var SpriteAnimation$1 = (function (_super) {
90
+ var SpriteAnimation$2 = (function (_super) {
91
91
  __extends(SpriteAnimation, _super);
92
92
  function SpriteAnimation() {
93
93
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -167,7 +167,8 @@ var SpriteAnimation$1 = (function (_super) {
167
167
  decorators.IDEProp
168
168
  ], SpriteAnimation.prototype, "speed", void 0);
169
169
  return SpriteAnimation;
170
- }(Component));
170
+ }(Component));
171
+ var SpriteAnimation$3 = SpriteAnimation$2;
171
172
 
172
173
  var resourceKeySplit = '_s|r|c_';
173
174
  resource.registerInstance(RESOURCE_TYPE.SPRITE_ANIMATION, function (_a) {
@@ -279,8 +280,7 @@ var SpriteAnimation = (function (_super) {
279
280
  case 2:
280
281
  if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 6];
281
282
  if (!(changed.prop && changed.prop.prop[0] === 'speed')) return [3, 3];
282
- this.animates[changed.gameObject.id].speed =
283
- 1000 / 60 / component.speed;
283
+ this.animates[changed.gameObject.id].speed = 1000 / 60 / component.speed;
284
284
  return [3, 5];
285
285
  case 3: return [4, resource.getResource(component.resource)];
286
286
  case 4:
@@ -307,11 +307,9 @@ var SpriteAnimation = (function (_super) {
307
307
  };
308
308
  SpriteAnimation.prototype.add = function (_a) {
309
309
  var frames = _a.frames, id = _a.id, component = _a.component;
310
- var animate = new SpriteAnimation$2({ frames: frames });
310
+ var animate = new SpriteAnimation$4({ frames: frames });
311
311
  this.animates[id] = animate;
312
- this.containerManager
313
- .getContainer(id)
314
- .addChildAt(animate.animatedSprite, 0);
312
+ this.containerManager.getContainer(id).addChildAt(animate.animatedSprite, 0);
315
313
  animate.animatedSprite.onComplete = function () {
316
314
  component.emit('complete');
317
315
  };
@@ -349,6 +347,7 @@ var SpriteAnimation = (function (_super) {
349
347
  })
350
348
  ], SpriteAnimation);
351
349
  return SpriteAnimation;
352
- }(Renderer));
350
+ }(Renderer));
351
+ var SpriteAnimation$1 = SpriteAnimation;
353
352
 
354
- export { SpriteAnimation$1 as SpriteAnimation, SpriteAnimation as SpriteAnimationSystem };
353
+ export { SpriteAnimation$3 as SpriteAnimation, SpriteAnimation$1 as SpriteAnimationSystem };
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
3
  if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./dist/plugin-renderer-sprite-animation.cjs.prod.js')
4
+ module.exports = require('./dist/plugin-renderer-sprite-animation.cjs.prod.js');
5
5
  } else {
6
- module.exports = require('./dist/plugin-renderer-sprite-animation.cjs.js')
6
+ module.exports = require('./dist/plugin-renderer-sprite-animation.cjs.js');
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-sprite-animation",
3
- "version": "1.1.1-alpha.0",
3
+ "version": "1.1.1-fix.1",
4
4
  "description": "@eva/plugin-renderer-sprite-animation",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-sprite-animation.esm.js",
@@ -18,9 +18,9 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/plugin-renderer": "1.1.1-alpha.0",
22
- "@eva/renderer-adapter": "1.1.1-alpha.0",
23
- "@eva/eva.js": "1.1.1-alpha.0",
21
+ "@eva/plugin-renderer": "1.1.1-fix.1",
22
+ "@eva/renderer-adapter": "1.1.1-fix.1",
23
+ "@eva/eva.js": "1.1.1-fix.1",
24
24
  "pixi.js": "^4.8.7"
25
25
  }
26
26
  }
@@ -1,362 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter'), require('pixi.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter', 'pixi.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.spriteAnimation = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter, global.PIXI));
5
- }(this, (function (exports, eva_js, pluginRenderer, rendererAdapter, pixi_js) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- function __decorate(decorators, target, key, desc) {
37
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
40
- return c > 3 && r && Object.defineProperty(target, key, r), r;
41
- }
42
-
43
- function __awaiter(thisArg, _arguments, P, generator) {
44
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45
- return new (P || (P = Promise))(function (resolve, reject) {
46
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
47
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
48
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
49
- step((generator = generator.apply(thisArg, _arguments || [])).next());
50
- });
51
- }
52
-
53
- function __generator(thisArg, body) {
54
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
55
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
56
- function verb(n) { return function (v) { return step([n, v]); }; }
57
- function step(op) {
58
- if (f) throw new TypeError("Generator is already executing.");
59
- while (_) try {
60
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
61
- if (y = 0, t) op = [op[0] & 2, t.value];
62
- switch (op[0]) {
63
- case 0: case 1: t = op; break;
64
- case 4: _.label++; return { value: op[1], done: false };
65
- case 5: _.label++; y = op[1]; op = [0]; continue;
66
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
67
- default:
68
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
69
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
70
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
71
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
72
- if (t[2]) _.ops.pop();
73
- _.trys.pop(); continue;
74
- }
75
- op = body.call(thisArg, _);
76
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
77
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
78
- }
79
- }
80
-
81
- function __values(o) {
82
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
83
- if (m) return m.call(o);
84
- if (o && typeof o.length === "number") return {
85
- next: function () {
86
- if (o && i >= o.length) o = void 0;
87
- return { value: o && o[i++], done: !o };
88
- }
89
- };
90
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
91
- }
92
-
93
- var SpriteAnimation$1 = (function (_super) {
94
- __extends(SpriteAnimation, _super);
95
- function SpriteAnimation() {
96
- var _this = _super !== null && _super.apply(this, arguments) || this;
97
- _this.resource = '';
98
- _this.autoPlay = true;
99
- _this.speed = 100;
100
- _this.waitPlay = false;
101
- _this.waitStop = false;
102
- _this.times = Infinity;
103
- _this.count = 0;
104
- return _this;
105
- }
106
- SpriteAnimation.prototype.init = function (obj) {
107
- var _this = this;
108
- obj && Object.assign(this, obj);
109
- this.on('loop', function () {
110
- if (++_this.count >= _this.times) {
111
- _this.animate.stop();
112
- _this.emit('complete');
113
- }
114
- });
115
- };
116
- SpriteAnimation.prototype.play = function (times) {
117
- if (times === void 0) { times = Infinity; }
118
- if (times === 0) {
119
- return;
120
- }
121
- this.times = times;
122
- if (!this.animate) {
123
- this.waitPlay = true;
124
- }
125
- else {
126
- this.animate.play();
127
- this.count = 0;
128
- }
129
- };
130
- SpriteAnimation.prototype.stop = function () {
131
- if (!this.animate) {
132
- this.waitStop = true;
133
- }
134
- else {
135
- this.animate.stop();
136
- }
137
- };
138
- Object.defineProperty(SpriteAnimation.prototype, "animate", {
139
- get: function () {
140
- return this._animate;
141
- },
142
- set: function (val) {
143
- this._animate = val;
144
- if (this.waitPlay) {
145
- this.waitPlay = false;
146
- this.play(this.times);
147
- }
148
- if (this.waitStop) {
149
- this.waitStop = false;
150
- this.stop();
151
- }
152
- },
153
- enumerable: false,
154
- configurable: true
155
- });
156
- SpriteAnimation.prototype.gotoAndPlay = function (frameNumber) {
157
- this.animate.gotoAndPlay(frameNumber);
158
- };
159
- SpriteAnimation.prototype.gotoAndStop = function (frameNumber) {
160
- this.animate.gotoAndStop(frameNumber);
161
- };
162
- SpriteAnimation.componentName = 'SpriteAnimation';
163
- __decorate([
164
- eva_js.decorators.IDEProp
165
- ], SpriteAnimation.prototype, "resource", void 0);
166
- __decorate([
167
- eva_js.decorators.IDEProp
168
- ], SpriteAnimation.prototype, "autoPlay", void 0);
169
- __decorate([
170
- eva_js.decorators.IDEProp
171
- ], SpriteAnimation.prototype, "speed", void 0);
172
- return SpriteAnimation;
173
- }(eva_js.Component));
174
-
175
- var resourceKeySplit = '_s|r|c_';
176
- eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.SPRITE_ANIMATION, function (_a) {
177
- var name = _a.name, data = _a.data;
178
- return new Promise(function (r) {
179
- var e_1, _a;
180
- var textureObj = data.json;
181
- var texture = pixi_js.BaseTexture.from(data.image);
182
- var frames = textureObj.frames || {};
183
- var animations = textureObj.animations || {};
184
- var newFrames = {};
185
- for (var key in frames) {
186
- var newKey = name + resourceKeySplit + key;
187
- newFrames[newKey] = frames[key];
188
- }
189
- for (var key in animations) {
190
- var spriteList = [];
191
- if (animations[key] && animations[key].length >= 0) {
192
- try {
193
- for (var _b = (e_1 = void 0, __values(animations[key])), _c = _b.next(); !_c.done; _c = _b.next()) {
194
- var spriteName = _c.value;
195
- var newSpriteName = name + resourceKeySplit + spriteName;
196
- spriteList.push(newSpriteName);
197
- }
198
- }
199
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
200
- finally {
201
- try {
202
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
203
- }
204
- finally { if (e_1) throw e_1.error; }
205
- }
206
- }
207
- animations[key] = spriteList;
208
- }
209
- textureObj.frames = newFrames;
210
- var spriteSheet = new pixi_js.Spritesheet(texture, textureObj);
211
- spriteSheet.parse(function () {
212
- var textures = spriteSheet.textures;
213
- var spriteFrames = [];
214
- for (var key in textures) {
215
- spriteFrames.push(textures[key]);
216
- }
217
- r(spriteFrames);
218
- });
219
- });
220
- });
221
- eva_js.resource.registerDestroy(eva_js.RESOURCE_TYPE.SPRITE_ANIMATION, function (_a) {
222
- var e_2, _b;
223
- var instance = _a.instance;
224
- if (!instance)
225
- return;
226
- try {
227
- for (var instance_1 = __values(instance), instance_1_1 = instance_1.next(); !instance_1_1.done; instance_1_1 = instance_1.next()) {
228
- var texture = instance_1_1.value;
229
- texture.destroy(true);
230
- }
231
- }
232
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
233
- finally {
234
- try {
235
- if (instance_1_1 && !instance_1_1.done && (_b = instance_1.return)) _b.call(instance_1);
236
- }
237
- finally { if (e_2) throw e_2.error; }
238
- }
239
- });
240
- var SpriteAnimation = (function (_super) {
241
- __extends(SpriteAnimation, _super);
242
- function SpriteAnimation() {
243
- var _this = _super !== null && _super.apply(this, arguments) || this;
244
- _this.name = 'SpriteAnimation';
245
- _this.animates = {};
246
- _this.autoPlay = {};
247
- return _this;
248
- }
249
- SpriteAnimation.prototype.init = function () {
250
- this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
251
- this.renderSystem.rendererManager.register(this);
252
- };
253
- SpriteAnimation.prototype.rendererUpdate = function (gameObject) {
254
- var _a = gameObject.transform.size, width = _a.width, height = _a.height;
255
- if (this.animates[gameObject.id]) {
256
- this.animates[gameObject.id].animatedSprite.width = width;
257
- this.animates[gameObject.id].animatedSprite.height = height;
258
- }
259
- };
260
- SpriteAnimation.prototype.componentChanged = function (changed) {
261
- return __awaiter(this, void 0, void 0, function () {
262
- var component, frames_1, frames_2;
263
- return __generator(this, function (_a) {
264
- switch (_a.label) {
265
- case 0:
266
- if (!(changed.componentName === 'SpriteAnimation')) return [3, 7];
267
- component = changed.component;
268
- this.autoPlay[changed.gameObject.id] = component.autoPlay;
269
- if (!(changed.type === eva_js.OBSERVER_TYPE.ADD)) return [3, 2];
270
- return [4, eva_js.resource.getResource(component.resource)];
271
- case 1:
272
- frames_1 = (_a.sent()).instance;
273
- if (!frames_1) {
274
- console.error("GameObject:" + changed.gameObject.name + "'s Img resource load error");
275
- }
276
- this.add({
277
- frames: frames_1,
278
- id: changed.gameObject.id,
279
- component: component,
280
- });
281
- return [3, 7];
282
- case 2:
283
- if (!(changed.type === eva_js.OBSERVER_TYPE.CHANGE)) return [3, 6];
284
- if (!(changed.prop && changed.prop.prop[0] === 'speed')) return [3, 3];
285
- this.animates[changed.gameObject.id].speed =
286
- 1000 / 60 / component.speed;
287
- return [3, 5];
288
- case 3: return [4, eva_js.resource.getResource(component.resource)];
289
- case 4:
290
- frames_2 = (_a.sent()).instance;
291
- if (!frames_2) {
292
- console.error("GameObject:" + changed.gameObject.name + "'s Img resource load error");
293
- }
294
- this.change({
295
- frames: frames_2,
296
- id: changed.gameObject.id,
297
- component: component,
298
- });
299
- _a.label = 5;
300
- case 5: return [3, 7];
301
- case 6:
302
- if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
303
- this.remove(changed.gameObject.id);
304
- }
305
- _a.label = 7;
306
- case 7: return [2];
307
- }
308
- });
309
- });
310
- };
311
- SpriteAnimation.prototype.add = function (_a) {
312
- var frames = _a.frames, id = _a.id, component = _a.component;
313
- var animate = new rendererAdapter.SpriteAnimation({ frames: frames });
314
- this.animates[id] = animate;
315
- this.containerManager
316
- .getContainer(id)
317
- .addChildAt(animate.animatedSprite, 0);
318
- animate.animatedSprite.onComplete = function () {
319
- component.emit('complete');
320
- };
321
- animate.animatedSprite.onFrameChange = function () {
322
- component.emit('frameChange');
323
- };
324
- animate.animatedSprite.onLoop = function () {
325
- component.emit('loop');
326
- };
327
- component.animate = this.animates[id];
328
- this.animates[id].speed = 1000 / 60 / component.speed;
329
- if (this.autoPlay[id]) {
330
- animate.animatedSprite.play();
331
- }
332
- };
333
- SpriteAnimation.prototype.change = function (_a) {
334
- var frames = _a.frames, id = _a.id, component = _a.component;
335
- this.remove(id, true);
336
- this.add({ frames: frames, id: id, component: component });
337
- };
338
- SpriteAnimation.prototype.remove = function (id, isChange) {
339
- var animate = this.animates[id];
340
- this.autoPlay[id] = animate.animatedSprite.playing;
341
- this.containerManager.getContainer(id).removeChild(animate.animatedSprite);
342
- animate.animatedSprite.destroy({ children: true });
343
- delete this.animates[id];
344
- if (!isChange) {
345
- delete this.autoPlay[id];
346
- }
347
- };
348
- SpriteAnimation.systemName = 'SpriteAnimation';
349
- SpriteAnimation = __decorate([
350
- eva_js.decorators.componentObserver({
351
- SpriteAnimation: ['speed', 'resource'],
352
- })
353
- ], SpriteAnimation);
354
- return SpriteAnimation;
355
- }(pluginRenderer.Renderer));
356
-
357
- exports.SpriteAnimation = SpriteAnimation$1;
358
- exports.SpriteAnimationSystem = SpriteAnimation;
359
-
360
- Object.defineProperty(exports, '__esModule', { value: true });
361
-
362
- })));
@@ -1 +0,0 @@
1
- var e,t;e=this,t=function(e,t,r,n,o){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function a(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function s(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function p(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{p(n.next(e))}catch(e){i(e)}}function s(e){try{p(n.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}p((n=n.apply(e,t||[])).next())}))}function c(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var l=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.resource="",t.autoPlay=!0,t.speed=100,t.waitPlay=!1,t.waitStop=!1,t.times=1/0,t.count=0,t}return a(r,e),r.prototype.init=function(e){var t=this;e&&Object.assign(this,e),this.on("loop",(function(){++t.count>=t.times&&(t.animate.stop(),t.emit("complete"))}))},r.prototype.play=function(e){void 0===e&&(e=1/0),0!==e&&(this.times=e,this.animate?(this.animate.play(),this.count=0):this.waitPlay=!0)},r.prototype.stop=function(){this.animate?this.animate.stop():this.waitStop=!0},Object.defineProperty(r.prototype,"animate",{get:function(){return this._animate},set:function(e){this._animate=e,this.waitPlay&&(this.waitPlay=!1,this.play(this.times)),this.waitStop&&(this.waitStop=!1,this.stop())},enumerable:!1,configurable:!0}),r.prototype.gotoAndPlay=function(e){this.animate.gotoAndPlay(e)},r.prototype.gotoAndStop=function(e){this.animate.gotoAndStop(e)},r.componentName="SpriteAnimation",s([t.decorators.IDEProp],r.prototype,"resource",void 0),s([t.decorators.IDEProp],r.prototype,"autoPlay",void 0),s([t.decorators.IDEProp],r.prototype,"speed",void 0),r}(t.Component),f="_s|r|c_";t.resource.registerInstance(t.RESOURCE_TYPE.SPRITE_ANIMATION,(function(e){var t=e.name,r=e.data;return new Promise((function(e){var n,i,a=r.json,s=o.BaseTexture.from(r.image),p=a.frames||{},c=a.animations||{},l={};for(var d in p)l[t+f+d]=p[d];for(var d in c){var m=[];if(c[d]&&c[d].length>=0)try{for(var h=(n=void 0,u(c[d])),y=h.next();!y.done;y=h.next()){var v=y.value,g=t+f+v;m.push(g)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}c[d]=m}a.frames=l;var b=new o.Spritesheet(s,a);b.parse((function(){var t=b.textures,r=[];for(var n in t)r.push(t[n]);e(r)}))}))})),t.resource.registerDestroy(t.RESOURCE_TYPE.SPRITE_ANIMATION,(function(e){var t,r,n=e.instance;if(n)try{for(var o=u(n),i=o.next();!i.done;i=o.next())i.value.destroy(!0)}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}));var d=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="SpriteAnimation",t.animates={},t.autoPlay={},t}return a(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(e){var t=e.transform.size,r=t.width,n=t.height;this.animates[e.id]&&(this.animates[e.id].animatedSprite.width=r,this.animates[e.id].animatedSprite.height=n)},o.prototype.componentChanged=function(e){return p(this,void 0,void 0,(function(){var r,n,o;return c(this,(function(i){switch(i.label){case 0:return"SpriteAnimation"!==e.componentName?[3,7]:(r=e.component,this.autoPlay[e.gameObject.id]=r.autoPlay,e.type!==t.OBSERVER_TYPE.ADD?[3,2]:[4,t.resource.getResource(r.resource)]);case 1:return(n=i.sent().instance)||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.add({frames:n,id:e.gameObject.id,component:r}),[3,7];case 2:return e.type!==t.OBSERVER_TYPE.CHANGE?[3,6]:e.prop&&"speed"===e.prop.prop[0]?(this.animates[e.gameObject.id].speed=1e3/60/r.speed,[3,5]):[3,3];case 3:return[4,t.resource.getResource(r.resource)];case 4:(o=i.sent().instance)||console.error("GameObject:"+e.gameObject.name+"'s Img resource load error"),this.change({frames:o,id:e.gameObject.id,component:r}),i.label=5;case 5:return[3,7];case 6:e.type===t.OBSERVER_TYPE.REMOVE&&this.remove(e.gameObject.id),i.label=7;case 7:return[2]}}))}))},o.prototype.add=function(e){var t=e.frames,r=e.id,o=e.component,i=new n.SpriteAnimation({frames:t});this.animates[r]=i,this.containerManager.getContainer(r).addChildAt(i.animatedSprite,0),i.animatedSprite.onComplete=function(){o.emit("complete")},i.animatedSprite.onFrameChange=function(){o.emit("frameChange")},i.animatedSprite.onLoop=function(){o.emit("loop")},o.animate=this.animates[r],this.animates[r].speed=1e3/60/o.speed,this.autoPlay[r]&&i.animatedSprite.play()},o.prototype.change=function(e){var t=e.frames,r=e.id,n=e.component;this.remove(r,!0),this.add({frames:t,id:r,component:n})},o.prototype.remove=function(e,t){var r=this.animates[e];this.autoPlay[e]=r.animatedSprite.playing,this.containerManager.getContainer(e).removeChild(r.animatedSprite),r.animatedSprite.destroy({children:!0}),delete this.animates[e],t||delete this.autoPlay[e]},o.systemName="SpriteAnimation",o=s([t.decorators.componentObserver({SpriteAnimation:["speed","resource"]})],o)}(r.Renderer);e.SpriteAnimation=l,e.SpriteAnimationSystem=d,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter","pixi.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.spriteAnimation={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter,e.PIXI);
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export declare const name = "a11y";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=a11y.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["a11y.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAmYhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "component";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAsJhC"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=compressed-texture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compressed-texture.d.ts","sourceRoot":"","sources":["compressed-texture.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export declare const name = "dragonbone";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=dragonbone.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dragonbone.d.ts","sourceRoot":"","sources":["dragonbone.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA8DhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "event";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=event.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["event.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAiFhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "graphics";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=graphics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphics.d.ts","sourceRoot":"","sources":["graphics.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,aAAa,CAAC;AAC/B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAsDhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "image";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=image.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["image.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA8ChC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "loader";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["loader.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA0HhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "lottie";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=lottie.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lottie.d.ts","sourceRoot":"","sources":["lottie.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,WAAW,CAAC;AAE7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAmHhC"}
@@ -1,4 +0,0 @@
1
- import "@eva/plugin-renderer-sprite";
2
- export declare const name = "mask";
3
- export declare function init(canavs: any): Promise<void>;
4
- //# sourceMappingURL=mask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["mask.ts"],"names":[],"mappings":"AAGA,OAAO,6BAA6B,CAAC;AAErC,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAoHhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "matter";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=matter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matter.d.ts","sourceRoot":"","sources":["matter.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA4ahC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "multi-canavs";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=multi-canvas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multi-canvas.d.ts","sourceRoot":"","sources":["multi-canvas.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAoFhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "ninePatch";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=ninePatch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ninePatch.d.ts","sourceRoot":"","sources":["ninePatch.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA2EhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "sound";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=sound.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["sound.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA2NhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "spine";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=spine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spine.d.ts","sourceRoot":"","sources":["spine.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,UAAU,CAAC;AAC5B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA+DhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "sprite";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=sprite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sprite.d.ts","sourceRoot":"","sources":["sprite.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA4HhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "spriteAnimation";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=spriteAnimation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spriteAnimation.d.ts","sourceRoot":"","sources":["spriteAnimation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,oBAAoB,CAAC;AACtC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAwDhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "text";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=text.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBA+DhC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "tilingSprite";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=tilingSprite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tilingSprite.d.ts","sourceRoot":"","sources":["tilingSprite.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAuChC"}
@@ -1,3 +0,0 @@
1
- export declare const name = "transition";
2
- export declare function init(canvas: any): Promise<void>;
3
- //# sourceMappingURL=transition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["transition.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,wBAAsB,IAAI,CAAC,MAAM,KAAA,iBAoIhC"}
@@ -1,63 +0,0 @@
1
- import { Component } from '@eva/eva.js';
2
- import { ComponentChanged } from '@eva/eva.js';
3
- import { ContainerManager } from '@eva/plugin-renderer';
4
- import { GameObject } from '@eva/eva.js';
5
- import { Renderer } from '@eva/plugin-renderer';
6
- import { RendererManager } from '@eva/plugin-renderer';
7
- import { RendererSystem } from '@eva/plugin-renderer';
8
- import { SpriteAnimation as SpriteAnimation_2 } from '@eva/renderer-adapter';
9
-
10
- export declare class SpriteAnimation extends Component<SpriteAnimationParams> {
11
- static componentName: string;
12
- resource: string;
13
- autoPlay: boolean;
14
- speed: number;
15
- _animate: SpriteAnimation_2;
16
- private waitPlay;
17
- private waitStop;
18
- private times;
19
- private count;
20
- init(obj?: SpriteAnimationParams): void;
21
- play(times?: number): void;
22
- stop(): void;
23
- set animate(val: SpriteAnimation_2);
24
- get animate(): SpriteAnimation_2;
25
- gotoAndPlay(frameNumber: any): void;
26
- gotoAndStop(frameNumber: any): void;
27
- }
28
-
29
- export declare interface SpriteAnimationParams {
30
- resource: string;
31
- autoPlay: boolean;
32
- speed: number;
33
- }
34
-
35
- export declare class SpriteAnimationSystem extends Renderer {
36
- static systemName: string;
37
- name: string;
38
- animates: {
39
- [propName: number]: SpriteAnimation_2;
40
- };
41
- autoPlay: {
42
- [propName: number]: boolean;
43
- };
44
- renderSystem: RendererSystem;
45
- rendererManager: RendererManager;
46
- containerManager: ContainerManager;
47
- init(): void;
48
- rendererUpdate(gameObject: GameObject): void;
49
- componentChanged(changed: ComponentChanged): Promise<void>;
50
- add({ frames, id, component }: {
51
- frames: any;
52
- id: any;
53
- component: any;
54
- }): void;
55
- change({ frames, id, component }: {
56
- frames: any;
57
- id: any;
58
- component: any;
59
- }): void;
60
- remove(id: any, isChange?: boolean): void;
61
- }
62
-
63
- export { }