@eva/plugin-renderer-sprite-animation 2.0.0-beta.1 → 2.0.0-beta.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/dist/EVA.plugin.renderer.spriteAnimation.js +168 -347
- package/dist/EVA.plugin.renderer.spriteAnimation.min.js +1 -1
- package/dist/plugin-renderer-sprite-animation.cjs.js +158 -271
- package/dist/plugin-renderer-sprite-animation.cjs.prod.js +16 -1
- package/dist/plugin-renderer-sprite-animation.esm.js +160 -273
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, resource, RESOURCE_TYPE, decorators, OBSERVER_TYPE } from '@eva/eva.js';
|
|
2
2
|
import { type, step } from '@eva/inspector-decorator';
|
|
3
|
-
import {
|
|
4
|
-
import { SpriteAnimation as SpriteAnimation$
|
|
3
|
+
import { Renderer, RendererSystem } from '@eva/plugin-renderer';
|
|
4
|
+
import { SpriteAnimation as SpriteAnimation$3 } from '@eva/renderer-adapter';
|
|
5
5
|
import { Texture, Spritesheet } from 'pixi.js';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
@@ -18,20 +18,6 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
18
18
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
19
19
|
and limitations under the License.
|
|
20
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
21
|
|
|
36
22
|
function __decorate(decorators, target, key, desc) {
|
|
37
23
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -47,80 +33,37 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
47
33
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
48
34
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
49
35
|
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function __generator(thisArg, body) {
|
|
53
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
54
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
55
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
56
|
-
function step(op) {
|
|
57
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
-
while (_) try {
|
|
59
|
-
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;
|
|
60
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
-
switch (op[0]) {
|
|
62
|
-
case 0: case 1: t = op; break;
|
|
63
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
64
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
65
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
66
|
-
default:
|
|
67
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
68
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
69
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
70
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
71
|
-
if (t[2]) _.ops.pop();
|
|
72
|
-
_.trys.pop(); continue;
|
|
73
|
-
}
|
|
74
|
-
op = body.call(thisArg, _);
|
|
75
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
76
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function __values(o) {
|
|
81
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
82
|
-
if (m) return m.call(o);
|
|
83
|
-
return {
|
|
84
|
-
next: function () {
|
|
85
|
-
if (o && i >= o.length) o = void 0;
|
|
86
|
-
return { value: o && o[i++], done: !o };
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
36
|
}
|
|
90
37
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
_this.complete = false;
|
|
104
|
-
return _this;
|
|
38
|
+
class SpriteAnimation$2 extends Component {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.resource = '';
|
|
42
|
+
this.autoPlay = true;
|
|
43
|
+
this.speed = 100;
|
|
44
|
+
this.forwards = false;
|
|
45
|
+
this.waitPlay = false;
|
|
46
|
+
this.waitStop = false;
|
|
47
|
+
this.times = Infinity;
|
|
48
|
+
this.count = 0;
|
|
49
|
+
this.complete = false;
|
|
105
50
|
}
|
|
106
|
-
|
|
107
|
-
var _this = this;
|
|
51
|
+
init(obj) {
|
|
108
52
|
obj && Object.assign(this, obj);
|
|
109
|
-
this.on('loop',
|
|
110
|
-
if (++
|
|
111
|
-
if (
|
|
112
|
-
|
|
53
|
+
this.on('loop', () => {
|
|
54
|
+
if (++this.count >= this.times) {
|
|
55
|
+
if (this.forwards) {
|
|
56
|
+
this.gotoAndStop(this.totalFrames - 1);
|
|
113
57
|
}
|
|
114
58
|
else {
|
|
115
|
-
|
|
59
|
+
this.animate.stop();
|
|
116
60
|
}
|
|
117
|
-
|
|
118
|
-
|
|
61
|
+
this.complete = true;
|
|
62
|
+
this.emit('complete');
|
|
119
63
|
}
|
|
120
64
|
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (times === void 0) { times = Infinity; }
|
|
65
|
+
}
|
|
66
|
+
play(times = Infinity) {
|
|
124
67
|
if (times === 0) {
|
|
125
68
|
return;
|
|
126
69
|
}
|
|
@@ -136,229 +79,175 @@ var SpriteAnimation$2 = (function (_super) {
|
|
|
136
79
|
this.count = 0;
|
|
137
80
|
this.complete = false;
|
|
138
81
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
82
|
+
}
|
|
83
|
+
stop() {
|
|
141
84
|
if (!this.animate) {
|
|
142
85
|
this.waitStop = true;
|
|
143
86
|
}
|
|
144
87
|
else {
|
|
145
88
|
this.animate.stop();
|
|
146
89
|
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
enumerable: false,
|
|
164
|
-
configurable: true
|
|
165
|
-
});
|
|
166
|
-
SpriteAnimation.prototype.gotoAndPlay = function (frameNumber) {
|
|
90
|
+
}
|
|
91
|
+
set animate(val) {
|
|
92
|
+
this._animate = val;
|
|
93
|
+
if (this.waitPlay) {
|
|
94
|
+
this.waitPlay = false;
|
|
95
|
+
this.play(this.times);
|
|
96
|
+
}
|
|
97
|
+
if (this.waitStop) {
|
|
98
|
+
this.waitStop = false;
|
|
99
|
+
this.stop();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
get animate() {
|
|
103
|
+
return this._animate;
|
|
104
|
+
}
|
|
105
|
+
gotoAndPlay(frameNumber) {
|
|
167
106
|
this.animate.gotoAndPlay(frameNumber);
|
|
168
|
-
}
|
|
169
|
-
|
|
107
|
+
}
|
|
108
|
+
gotoAndStop(frameNumber) {
|
|
170
109
|
this.animate.gotoAndStop(frameNumber);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
__decorate([
|
|
196
|
-
type('number'),
|
|
197
|
-
step(10)
|
|
198
|
-
], SpriteAnimation.prototype, "speed", void 0);
|
|
199
|
-
__decorate([
|
|
200
|
-
type('boolean')
|
|
201
|
-
], SpriteAnimation.prototype, "forwards", void 0);
|
|
202
|
-
return SpriteAnimation;
|
|
203
|
-
}(Component));
|
|
204
|
-
var SpriteAnimation$3 = SpriteAnimation$2;
|
|
110
|
+
}
|
|
111
|
+
get currentFrame() {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
return (_b = (_a = this.animate) === null || _a === void 0 ? void 0 : _a.animatedSprite) === null || _b === void 0 ? void 0 : _b.currentFrame;
|
|
114
|
+
}
|
|
115
|
+
get totalFrames() {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
return (_b = (_a = this.animate) === null || _a === void 0 ? void 0 : _a.animatedSprite) === null || _b === void 0 ? void 0 : _b.totalFrames;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
SpriteAnimation$2.componentName = 'SpriteAnimation';
|
|
121
|
+
__decorate([
|
|
122
|
+
type('string')
|
|
123
|
+
], SpriteAnimation$2.prototype, "resource", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
type('boolean')
|
|
126
|
+
], SpriteAnimation$2.prototype, "autoPlay", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
type('number'),
|
|
129
|
+
step(10)
|
|
130
|
+
], SpriteAnimation$2.prototype, "speed", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
type('boolean')
|
|
133
|
+
], SpriteAnimation$2.prototype, "forwards", void 0);
|
|
205
134
|
|
|
206
|
-
|
|
207
|
-
resource.registerInstance(RESOURCE_TYPE.SPRITE_ANIMATION,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
for (var key in frames) {
|
|
217
|
-
var newKey = name + resourceKeySplit + key;
|
|
135
|
+
const resourceKeySplit = '_s|r|c_';
|
|
136
|
+
resource.registerInstance(RESOURCE_TYPE.SPRITE_ANIMATION, ({ name, data }) => {
|
|
137
|
+
return new Promise(r => {
|
|
138
|
+
const textureObj = data.json.data;
|
|
139
|
+
const texture = data.image instanceof Texture ? data.image : Texture.from(data.image);
|
|
140
|
+
const frames = textureObj.frames || {};
|
|
141
|
+
const animations = textureObj.animations || {};
|
|
142
|
+
const newFrames = {};
|
|
143
|
+
for (const key in frames) {
|
|
144
|
+
const newKey = name + resourceKeySplit + key;
|
|
218
145
|
newFrames[newKey] = frames[key];
|
|
219
146
|
}
|
|
220
|
-
for (
|
|
221
|
-
|
|
147
|
+
for (const key in animations) {
|
|
148
|
+
const spriteList = [];
|
|
222
149
|
if (animations[key] && animations[key].length >= 0) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
var newSpriteName = name + resourceKeySplit + spriteName;
|
|
227
|
-
spriteList.push(newSpriteName);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
231
|
-
finally {
|
|
232
|
-
try {
|
|
233
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
234
|
-
}
|
|
235
|
-
finally { if (e_1) throw e_1.error; }
|
|
150
|
+
for (const spriteName of animations[key]) {
|
|
151
|
+
const newSpriteName = name + resourceKeySplit + spriteName;
|
|
152
|
+
spriteList.push(newSpriteName);
|
|
236
153
|
}
|
|
237
154
|
}
|
|
238
155
|
animations[key] = spriteList;
|
|
239
156
|
}
|
|
240
157
|
textureObj.frames = newFrames;
|
|
241
|
-
|
|
242
|
-
spriteSheet.parse().then(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
for (
|
|
158
|
+
const spriteSheet = new Spritesheet(texture, textureObj);
|
|
159
|
+
spriteSheet.parse().then(() => {
|
|
160
|
+
const { textures } = spriteSheet;
|
|
161
|
+
const spriteFrames = [];
|
|
162
|
+
for (const key in textures) {
|
|
246
163
|
spriteFrames.push(textures[key]);
|
|
247
164
|
}
|
|
248
165
|
r(spriteFrames);
|
|
249
166
|
});
|
|
250
167
|
});
|
|
251
168
|
});
|
|
252
|
-
resource.registerDestroy(RESOURCE_TYPE.SPRITE_ANIMATION,
|
|
253
|
-
var e_2, _b;
|
|
254
|
-
var instance = _a.instance;
|
|
169
|
+
resource.registerDestroy(RESOURCE_TYPE.SPRITE_ANIMATION, ({ instance }) => {
|
|
255
170
|
if (!instance)
|
|
256
171
|
return;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var texture = instance_1_1.value;
|
|
260
|
-
texture.destroy(true);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
264
|
-
finally {
|
|
265
|
-
try {
|
|
266
|
-
if (instance_1_1 && !instance_1_1.done && (_b = instance_1.return)) _b.call(instance_1);
|
|
267
|
-
}
|
|
268
|
-
finally { if (e_2) throw e_2.error; }
|
|
172
|
+
for (const texture of instance) {
|
|
173
|
+
texture.destroy(true);
|
|
269
174
|
}
|
|
270
175
|
});
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
_this.autoPlay = {};
|
|
278
|
-
return _this;
|
|
176
|
+
let SpriteAnimation = class SpriteAnimation extends Renderer {
|
|
177
|
+
constructor() {
|
|
178
|
+
super(...arguments);
|
|
179
|
+
this.name = 'SpriteAnimation';
|
|
180
|
+
this.animates = {};
|
|
181
|
+
this.autoPlay = {};
|
|
279
182
|
}
|
|
280
|
-
|
|
183
|
+
init() {
|
|
281
184
|
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
282
185
|
this.renderSystem.rendererManager.register(this);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
186
|
+
}
|
|
187
|
+
rendererUpdate(gameObject) {
|
|
188
|
+
const { width, height } = gameObject.transform.size;
|
|
286
189
|
if (this.animates[gameObject.id]) {
|
|
287
190
|
this.animates[gameObject.id].animatedSprite.width = width;
|
|
288
191
|
this.animates[gameObject.id].animatedSprite.height = height;
|
|
289
192
|
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
id: changed.gameObject.id,
|
|
314
|
-
component: component,
|
|
315
|
-
});
|
|
316
|
-
return [3, 7];
|
|
317
|
-
case 2:
|
|
318
|
-
if (!(changed.type === OBSERVER_TYPE.CHANGE)) return [3, 6];
|
|
319
|
-
if (!(changed.prop && changed.prop.prop[0] === 'speed')) return [3, 3];
|
|
193
|
+
}
|
|
194
|
+
componentChanged(changed) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
const gameObjectId = changed.gameObject.id;
|
|
197
|
+
if (changed.componentName === 'SpriteAnimation') {
|
|
198
|
+
const component = changed.component;
|
|
199
|
+
this.autoPlay[changed.gameObject.id] = component.autoPlay;
|
|
200
|
+
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
201
|
+
const asyncId = this.increaseAsyncId(gameObjectId);
|
|
202
|
+
const { instance: frames } = yield resource.getResource(component.resource);
|
|
203
|
+
if (!this.validateAsyncId(gameObjectId, asyncId))
|
|
204
|
+
return;
|
|
205
|
+
if (!frames) {
|
|
206
|
+
console.error(`GameObject:${changed.gameObject.name}'s Img resource load error`);
|
|
207
|
+
}
|
|
208
|
+
this.add({
|
|
209
|
+
frames: frames,
|
|
210
|
+
id: changed.gameObject.id,
|
|
211
|
+
component,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
else if (changed.type === OBSERVER_TYPE.CHANGE) {
|
|
215
|
+
if (changed.prop && changed.prop.prop[0] === 'speed') {
|
|
320
216
|
this.animates[changed.gameObject.id].speed = 1000 / 60 / component.speed;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
asyncId = this.increaseAsyncId(gameObjectId);
|
|
324
|
-
|
|
325
|
-
case 4:
|
|
326
|
-
frames_2 = (_a.sent()).instance;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const asyncId = this.increaseAsyncId(gameObjectId);
|
|
220
|
+
const { instance: frames } = yield resource.getResource(component.resource);
|
|
327
221
|
if (!this.validateAsyncId(gameObjectId, asyncId))
|
|
328
|
-
return
|
|
329
|
-
if (!
|
|
330
|
-
console.error(
|
|
222
|
+
return;
|
|
223
|
+
if (!frames) {
|
|
224
|
+
console.error(`GameObject:${changed.gameObject.name}'s Img resource load error`);
|
|
331
225
|
}
|
|
332
226
|
this.change({
|
|
333
|
-
frames:
|
|
227
|
+
frames: frames,
|
|
334
228
|
id: changed.gameObject.id,
|
|
335
|
-
component
|
|
229
|
+
component,
|
|
336
230
|
});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
this.remove(changed.gameObject.id);
|
|
343
|
-
}
|
|
344
|
-
_a.label = 7;
|
|
345
|
-
case 7: return [2];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
234
|
+
this.increaseAsyncId(gameObjectId);
|
|
235
|
+
this.remove(changed.gameObject.id);
|
|
346
236
|
}
|
|
347
|
-
}
|
|
237
|
+
}
|
|
348
238
|
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
var animate = new SpriteAnimation$4({ frames: frames });
|
|
239
|
+
}
|
|
240
|
+
add({ frames, id, component }) {
|
|
241
|
+
const animate = new SpriteAnimation$3({ frames });
|
|
353
242
|
this.animates[id] = animate;
|
|
354
243
|
this.containerManager.getContainer(id).addChildAt(animate.animatedSprite, 0);
|
|
355
|
-
animate.animatedSprite.onComplete =
|
|
244
|
+
animate.animatedSprite.onComplete = () => {
|
|
356
245
|
component.emit('complete');
|
|
357
246
|
};
|
|
358
|
-
animate.animatedSprite.onFrameChange =
|
|
247
|
+
animate.animatedSprite.onFrameChange = () => {
|
|
359
248
|
component.emit('frameChange');
|
|
360
249
|
};
|
|
361
|
-
animate.animatedSprite.onLoop =
|
|
250
|
+
animate.animatedSprite.onLoop = () => {
|
|
362
251
|
component.emit('loop');
|
|
363
252
|
};
|
|
364
253
|
component.animate = this.animates[id];
|
|
@@ -366,14 +255,13 @@ var SpriteAnimation = (function (_super) {
|
|
|
366
255
|
if (this.autoPlay[id]) {
|
|
367
256
|
animate.animatedSprite.play();
|
|
368
257
|
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
var frames = _a.frames, id = _a.id, component = _a.component;
|
|
258
|
+
}
|
|
259
|
+
change({ frames, id, component }) {
|
|
372
260
|
this.remove(id, true);
|
|
373
|
-
this.add({ frames
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
261
|
+
this.add({ frames, id, component });
|
|
262
|
+
}
|
|
263
|
+
remove(id, isChange) {
|
|
264
|
+
const animate = this.animates[id];
|
|
377
265
|
if (!animate)
|
|
378
266
|
return;
|
|
379
267
|
this.autoPlay[id] = animate.animatedSprite.playing;
|
|
@@ -383,15 +271,14 @@ var SpriteAnimation = (function (_super) {
|
|
|
383
271
|
if (!isChange) {
|
|
384
272
|
delete this.autoPlay[id];
|
|
385
273
|
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}(Renderer));
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
SpriteAnimation.systemName = 'SpriteAnimation';
|
|
277
|
+
SpriteAnimation = __decorate([
|
|
278
|
+
decorators.componentObserver({
|
|
279
|
+
SpriteAnimation: ['speed', 'resource'],
|
|
280
|
+
})
|
|
281
|
+
], SpriteAnimation);
|
|
395
282
|
var SpriteAnimation$1 = SpriteAnimation;
|
|
396
283
|
|
|
397
|
-
export { SpriteAnimation$
|
|
284
|
+
export { SpriteAnimation$2 as SpriteAnimation, SpriteAnimation$1 as SpriteAnimationSystem };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-sprite-animation",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "@eva/plugin-renderer-sprite-animation",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-sprite-animation.esm.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
-
"@eva/plugin-renderer": "2.0.0-beta.
|
|
23
|
-
"@eva/renderer-adapter": "2.0.0-beta.
|
|
24
|
-
"@eva/eva.js": "2.0.0-beta.
|
|
22
|
+
"@eva/plugin-renderer": "2.0.0-beta.3",
|
|
23
|
+
"@eva/renderer-adapter": "2.0.0-beta.3",
|
|
24
|
+
"@eva/eva.js": "2.0.0-beta.3",
|
|
25
25
|
"pixi.js": "^8.6.3"
|
|
26
26
|
}
|
|
27
27
|
}
|