@eva/plugin-transition 1.2.7-editor.8 → 1.2.7-fix.4
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.transition.js +15 -220
- package/dist/EVA.plugin.transition.min.js +1 -1
- package/dist/miniprogram.js +276 -0
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
window.EVA = window.EVA || {};
|
|
2
2
|
window.EVA.plugin = window.EVA.plugin || {};
|
|
3
|
-
|
|
4
3
|
var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
5
4
|
'use strict';
|
|
6
5
|
|
|
@@ -14,24 +13,19 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
14
13
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
15
14
|
}
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
return _extendStatics(d, b);
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
function __extends(d, b) {
|
|
22
19
|
_extendStatics(d, b);
|
|
23
|
-
|
|
24
20
|
function __() {
|
|
25
21
|
this.constructor = d;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
function __values(o) {
|
|
32
26
|
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
m = s && o[s],
|
|
28
|
+
i = 0;
|
|
35
29
|
if (m) return m.call(o);
|
|
36
30
|
if (o && typeof o.length === "number") return {
|
|
37
31
|
next: function next() {
|
|
@@ -62,7 +56,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
62
56
|
if ((amount *= 2) < 1) {
|
|
63
57
|
return 0.5 * amount * amount;
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
return -0.5 * (--amount * (amount - 2) - 1);
|
|
67
60
|
}
|
|
68
61
|
},
|
|
@@ -77,7 +70,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
77
70
|
if ((amount *= 2) < 1) {
|
|
78
71
|
return 0.5 * amount * amount * amount;
|
|
79
72
|
}
|
|
80
|
-
|
|
81
73
|
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
|
82
74
|
}
|
|
83
75
|
},
|
|
@@ -92,7 +84,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
92
84
|
if ((amount *= 2) < 1) {
|
|
93
85
|
return 0.5 * amount * amount * amount * amount;
|
|
94
86
|
}
|
|
95
|
-
|
|
96
87
|
return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
|
|
97
88
|
}
|
|
98
89
|
},
|
|
@@ -107,7 +98,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
107
98
|
if ((amount *= 2) < 1) {
|
|
108
99
|
return 0.5 * amount * amount * amount * amount * amount;
|
|
109
100
|
}
|
|
110
|
-
|
|
111
101
|
return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
|
|
112
102
|
}
|
|
113
103
|
},
|
|
@@ -133,15 +123,12 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
133
123
|
if (amount === 0) {
|
|
134
124
|
return 0;
|
|
135
125
|
}
|
|
136
|
-
|
|
137
126
|
if (amount === 1) {
|
|
138
127
|
return 1;
|
|
139
128
|
}
|
|
140
|
-
|
|
141
129
|
if ((amount *= 2) < 1) {
|
|
142
130
|
return 0.5 * Math.pow(1024, amount - 1);
|
|
143
131
|
}
|
|
144
|
-
|
|
145
132
|
return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
|
|
146
133
|
}
|
|
147
134
|
},
|
|
@@ -156,7 +143,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
156
143
|
if ((amount *= 2) < 1) {
|
|
157
144
|
return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
|
|
158
145
|
}
|
|
159
|
-
|
|
160
146
|
return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
|
|
161
147
|
}
|
|
162
148
|
},
|
|
@@ -165,39 +151,31 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
165
151
|
if (amount === 0) {
|
|
166
152
|
return 0;
|
|
167
153
|
}
|
|
168
|
-
|
|
169
154
|
if (amount === 1) {
|
|
170
155
|
return 1;
|
|
171
156
|
}
|
|
172
|
-
|
|
173
157
|
return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
|
174
158
|
},
|
|
175
159
|
Out: function Out(amount) {
|
|
176
160
|
if (amount === 0) {
|
|
177
161
|
return 0;
|
|
178
162
|
}
|
|
179
|
-
|
|
180
163
|
if (amount === 1) {
|
|
181
164
|
return 1;
|
|
182
165
|
}
|
|
183
|
-
|
|
184
166
|
return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
|
|
185
167
|
},
|
|
186
168
|
InOut: function InOut(amount) {
|
|
187
169
|
if (amount === 0) {
|
|
188
170
|
return 0;
|
|
189
171
|
}
|
|
190
|
-
|
|
191
172
|
if (amount === 1) {
|
|
192
173
|
return 1;
|
|
193
174
|
}
|
|
194
|
-
|
|
195
175
|
amount *= 2;
|
|
196
|
-
|
|
197
176
|
if (amount < 1) {
|
|
198
177
|
return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
|
|
199
178
|
}
|
|
200
|
-
|
|
201
179
|
return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
|
|
202
180
|
}
|
|
203
181
|
},
|
|
@@ -212,11 +190,9 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
212
190
|
},
|
|
213
191
|
InOut: function InOut(amount) {
|
|
214
192
|
var s = 1.70158 * 1.525;
|
|
215
|
-
|
|
216
193
|
if ((amount *= 2) < 1) {
|
|
217
194
|
return 0.5 * (amount * amount * ((s + 1) * amount - s));
|
|
218
195
|
}
|
|
219
|
-
|
|
220
196
|
return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
|
|
221
197
|
}
|
|
222
198
|
},
|
|
@@ -239,28 +215,28 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
239
215
|
if (amount < 0.5) {
|
|
240
216
|
return Easing.Bounce.In(amount * 2) * 0.5;
|
|
241
217
|
}
|
|
242
|
-
|
|
243
218
|
return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
|
|
244
219
|
}
|
|
245
220
|
}
|
|
246
221
|
};
|
|
247
222
|
var now;
|
|
248
|
-
|
|
249
223
|
if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {
|
|
250
224
|
now = function now() {
|
|
251
225
|
var time = process.hrtime();
|
|
252
226
|
return time[0] * 1000 + time[1] / 1000000;
|
|
253
227
|
};
|
|
254
|
-
}
|
|
228
|
+
}
|
|
229
|
+
else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {
|
|
255
230
|
now = self.performance.now.bind(self.performance);
|
|
256
|
-
}
|
|
231
|
+
}
|
|
232
|
+
else if (Date.now !== undefined) {
|
|
257
233
|
now = Date.now;
|
|
258
|
-
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
259
236
|
now = function now() {
|
|
260
237
|
return new Date().getTime();
|
|
261
238
|
};
|
|
262
239
|
}
|
|
263
|
-
|
|
264
240
|
var now$1 = now;
|
|
265
241
|
|
|
266
242
|
var Group = function () {
|
|
@@ -268,62 +244,47 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
268
244
|
this._tweens = {};
|
|
269
245
|
this._tweensAddedDuringUpdate = {};
|
|
270
246
|
}
|
|
271
|
-
|
|
272
247
|
Group.prototype.getAll = function () {
|
|
273
248
|
var _this = this;
|
|
274
|
-
|
|
275
249
|
return Object.keys(this._tweens).map(function (tweenId) {
|
|
276
250
|
return _this._tweens[tweenId];
|
|
277
251
|
});
|
|
278
252
|
};
|
|
279
|
-
|
|
280
253
|
Group.prototype.removeAll = function () {
|
|
281
254
|
this._tweens = {};
|
|
282
255
|
};
|
|
283
|
-
|
|
284
256
|
Group.prototype.add = function (tween) {
|
|
285
257
|
this._tweens[tween.getId()] = tween;
|
|
286
258
|
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
|
287
259
|
};
|
|
288
|
-
|
|
289
260
|
Group.prototype.remove = function (tween) {
|
|
290
261
|
delete this._tweens[tween.getId()];
|
|
291
262
|
delete this._tweensAddedDuringUpdate[tween.getId()];
|
|
292
263
|
};
|
|
293
|
-
|
|
294
264
|
Group.prototype.update = function (time, preserve) {
|
|
295
265
|
if (time === void 0) {
|
|
296
266
|
time = now$1();
|
|
297
267
|
}
|
|
298
|
-
|
|
299
268
|
if (preserve === void 0) {
|
|
300
269
|
preserve = false;
|
|
301
270
|
}
|
|
302
|
-
|
|
303
271
|
var tweenIds = Object.keys(this._tweens);
|
|
304
|
-
|
|
305
272
|
if (tweenIds.length === 0) {
|
|
306
273
|
return false;
|
|
307
274
|
}
|
|
308
|
-
|
|
309
275
|
while (tweenIds.length > 0) {
|
|
310
276
|
this._tweensAddedDuringUpdate = {};
|
|
311
|
-
|
|
312
277
|
for (var i = 0; i < tweenIds.length; i++) {
|
|
313
278
|
var tween = this._tweens[tweenIds[i]];
|
|
314
279
|
var autoStart = !preserve;
|
|
315
|
-
|
|
316
280
|
if (tween && tween.update(time, autoStart) === false && !preserve) {
|
|
317
281
|
delete this._tweens[tweenIds[i]];
|
|
318
282
|
}
|
|
319
283
|
}
|
|
320
|
-
|
|
321
284
|
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
|
322
285
|
}
|
|
323
|
-
|
|
324
286
|
return true;
|
|
325
287
|
};
|
|
326
|
-
|
|
327
288
|
return Group;
|
|
328
289
|
}();
|
|
329
290
|
|
|
@@ -333,15 +294,12 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
333
294
|
var f = m * k;
|
|
334
295
|
var i = Math.floor(f);
|
|
335
296
|
var fn = Interpolation.Utils.Linear;
|
|
336
|
-
|
|
337
297
|
if (k < 0) {
|
|
338
298
|
return fn(v[0], v[1], f);
|
|
339
299
|
}
|
|
340
|
-
|
|
341
300
|
if (k > 1) {
|
|
342
301
|
return fn(v[m], v[m - 1], m - f);
|
|
343
302
|
}
|
|
344
|
-
|
|
345
303
|
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
|
|
346
304
|
},
|
|
347
305
|
Bezier: function Bezier(v, k) {
|
|
@@ -349,11 +307,9 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
349
307
|
var n = v.length - 1;
|
|
350
308
|
var pw = Math.pow;
|
|
351
309
|
var bn = Interpolation.Utils.Bernstein;
|
|
352
|
-
|
|
353
310
|
for (var i = 0; i <= n; i++) {
|
|
354
311
|
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
|
|
355
312
|
}
|
|
356
|
-
|
|
357
313
|
return b;
|
|
358
314
|
},
|
|
359
315
|
CatmullRom: function CatmullRom(v, k) {
|
|
@@ -361,22 +317,18 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
361
317
|
var f = m * k;
|
|
362
318
|
var i = Math.floor(f);
|
|
363
319
|
var fn = Interpolation.Utils.CatmullRom;
|
|
364
|
-
|
|
365
320
|
if (v[0] === v[m]) {
|
|
366
321
|
if (k < 0) {
|
|
367
322
|
i = Math.floor(f = m * (1 + k));
|
|
368
323
|
}
|
|
369
|
-
|
|
370
324
|
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
|
|
371
325
|
} else {
|
|
372
326
|
if (k < 0) {
|
|
373
327
|
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
|
|
374
328
|
}
|
|
375
|
-
|
|
376
329
|
if (k > 1) {
|
|
377
330
|
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
|
|
378
331
|
}
|
|
379
|
-
|
|
380
332
|
return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
|
|
381
333
|
}
|
|
382
334
|
},
|
|
@@ -392,15 +344,12 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
392
344
|
var a = [1];
|
|
393
345
|
return function (n) {
|
|
394
346
|
var s = 1;
|
|
395
|
-
|
|
396
347
|
if (a[n]) {
|
|
397
348
|
return a[n];
|
|
398
349
|
}
|
|
399
|
-
|
|
400
350
|
for (var i = n; i > 1; i--) {
|
|
401
351
|
s *= i;
|
|
402
352
|
}
|
|
403
|
-
|
|
404
353
|
a[n] = s;
|
|
405
354
|
return s;
|
|
406
355
|
};
|
|
@@ -417,15 +366,12 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
417
366
|
|
|
418
367
|
var Sequence = function () {
|
|
419
368
|
function Sequence() {}
|
|
420
|
-
|
|
421
369
|
Sequence.nextId = function () {
|
|
422
370
|
return Sequence._nextId++;
|
|
423
371
|
};
|
|
424
|
-
|
|
425
372
|
Sequence._nextId = 0;
|
|
426
373
|
return Sequence;
|
|
427
374
|
}();
|
|
428
|
-
|
|
429
375
|
var mainGroup = new Group();
|
|
430
376
|
|
|
431
377
|
var Tween = function () {
|
|
@@ -433,7 +379,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
433
379
|
if (_group === void 0) {
|
|
434
380
|
_group = mainGroup;
|
|
435
381
|
}
|
|
436
|
-
|
|
437
382
|
this._object = _object;
|
|
438
383
|
this._group = _group;
|
|
439
384
|
this._isPaused = false;
|
|
@@ -457,101 +402,76 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
457
402
|
this._isChainStopped = false;
|
|
458
403
|
this._goToEnd = false;
|
|
459
404
|
}
|
|
460
|
-
|
|
461
405
|
Tween.prototype.getId = function () {
|
|
462
406
|
return this._id;
|
|
463
407
|
};
|
|
464
|
-
|
|
465
408
|
Tween.prototype.isPlaying = function () {
|
|
466
409
|
return this._isPlaying;
|
|
467
410
|
};
|
|
468
|
-
|
|
469
411
|
Tween.prototype.isPaused = function () {
|
|
470
412
|
return this._isPaused;
|
|
471
413
|
};
|
|
472
|
-
|
|
473
414
|
Tween.prototype.to = function (properties, duration) {
|
|
474
415
|
this._valuesEnd = Object.create(properties);
|
|
475
|
-
|
|
476
416
|
if (duration !== undefined) {
|
|
477
417
|
this._duration = duration;
|
|
478
418
|
}
|
|
479
|
-
|
|
480
419
|
return this;
|
|
481
420
|
};
|
|
482
|
-
|
|
483
421
|
Tween.prototype.duration = function (d) {
|
|
484
422
|
this._duration = d;
|
|
485
423
|
return this;
|
|
486
424
|
};
|
|
487
|
-
|
|
488
425
|
Tween.prototype.start = function (time) {
|
|
489
426
|
if (this._isPlaying) {
|
|
490
427
|
return this;
|
|
491
428
|
}
|
|
492
|
-
|
|
493
429
|
this._group && this._group.add(this);
|
|
494
430
|
this._repeat = this._initialRepeat;
|
|
495
|
-
|
|
496
431
|
if (this._reversed) {
|
|
497
432
|
this._reversed = false;
|
|
498
|
-
|
|
499
433
|
for (var property in this._valuesStartRepeat) {
|
|
500
434
|
this._swapEndStartRepeatValues(property);
|
|
501
|
-
|
|
502
435
|
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
503
436
|
}
|
|
504
437
|
}
|
|
505
|
-
|
|
506
438
|
this._isPlaying = true;
|
|
507
439
|
this._isPaused = false;
|
|
508
440
|
this._onStartCallbackFired = false;
|
|
509
441
|
this._isChainStopped = false;
|
|
510
442
|
this._startTime = time !== undefined ? typeof time === 'string' ? now$1() + parseFloat(time) : time : now$1();
|
|
511
443
|
this._startTime += this._delayTime;
|
|
512
|
-
|
|
513
444
|
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);
|
|
514
|
-
|
|
515
445
|
return this;
|
|
516
446
|
};
|
|
517
|
-
|
|
518
447
|
Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) {
|
|
519
448
|
for (var property in _valuesEnd) {
|
|
520
449
|
var startValue = _object[property];
|
|
521
450
|
var startValueIsArray = Array.isArray(startValue);
|
|
522
451
|
var propType = startValueIsArray ? 'array' : typeof startValue;
|
|
523
452
|
var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
|
|
524
|
-
|
|
525
453
|
if (propType === 'undefined' || propType === 'function') {
|
|
526
454
|
continue;
|
|
527
455
|
}
|
|
528
|
-
|
|
529
456
|
if (isInterpolationList) {
|
|
530
457
|
var endValues = _valuesEnd[property];
|
|
531
|
-
|
|
532
458
|
if (endValues.length === 0) {
|
|
533
459
|
continue;
|
|
534
460
|
}
|
|
535
|
-
|
|
536
461
|
endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
|
|
537
462
|
_valuesEnd[property] = [startValue].concat(endValues);
|
|
538
463
|
}
|
|
539
|
-
|
|
540
464
|
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
|
541
465
|
_valuesStart[property] = startValueIsArray ? [] : {};
|
|
542
|
-
|
|
543
466
|
for (var prop in startValue) {
|
|
544
467
|
_valuesStart[property][prop] = startValue[prop];
|
|
545
468
|
}
|
|
546
|
-
|
|
547
469
|
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
|
548
|
-
|
|
549
470
|
this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);
|
|
550
471
|
} else {
|
|
551
472
|
if (typeof _valuesStart[property] === 'undefined') {
|
|
552
473
|
_valuesStart[property] = startValue;
|
|
553
474
|
}
|
|
554
|
-
|
|
555
475
|
if (!startValueIsArray) {
|
|
556
476
|
_valuesStart[property] *= 1.0;
|
|
557
477
|
}
|
|
@@ -564,293 +484,233 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
564
484
|
}
|
|
565
485
|
}
|
|
566
486
|
};
|
|
567
|
-
|
|
568
487
|
Tween.prototype.stop = function () {
|
|
569
488
|
if (!this._isChainStopped) {
|
|
570
489
|
this._isChainStopped = true;
|
|
571
490
|
this.stopChainedTweens();
|
|
572
491
|
}
|
|
573
|
-
|
|
574
492
|
if (!this._isPlaying) {
|
|
575
493
|
return this;
|
|
576
494
|
}
|
|
577
|
-
|
|
578
495
|
this._group && this._group.remove(this);
|
|
579
496
|
this._isPlaying = false;
|
|
580
497
|
this._isPaused = false;
|
|
581
|
-
|
|
582
498
|
if (this._onStopCallback) {
|
|
583
499
|
this._onStopCallback(this._object);
|
|
584
500
|
}
|
|
585
|
-
|
|
586
501
|
return this;
|
|
587
502
|
};
|
|
588
|
-
|
|
589
503
|
Tween.prototype.end = function () {
|
|
590
504
|
this._goToEnd = true;
|
|
591
505
|
this.update(Infinity);
|
|
592
506
|
return this;
|
|
593
507
|
};
|
|
594
|
-
|
|
595
508
|
Tween.prototype.pause = function (time) {
|
|
596
509
|
if (time === void 0) {
|
|
597
510
|
time = now$1();
|
|
598
511
|
}
|
|
599
|
-
|
|
600
512
|
if (this._isPaused || !this._isPlaying) {
|
|
601
513
|
return this;
|
|
602
514
|
}
|
|
603
|
-
|
|
604
515
|
this._isPaused = true;
|
|
605
516
|
this._pauseStart = time;
|
|
606
517
|
this._group && this._group.remove(this);
|
|
607
518
|
return this;
|
|
608
519
|
};
|
|
609
|
-
|
|
610
520
|
Tween.prototype.resume = function (time) {
|
|
611
521
|
if (time === void 0) {
|
|
612
522
|
time = now$1();
|
|
613
523
|
}
|
|
614
|
-
|
|
615
524
|
if (!this._isPaused || !this._isPlaying) {
|
|
616
525
|
return this;
|
|
617
526
|
}
|
|
618
|
-
|
|
619
527
|
this._isPaused = false;
|
|
620
528
|
this._startTime += time - this._pauseStart;
|
|
621
529
|
this._pauseStart = 0;
|
|
622
530
|
this._group && this._group.add(this);
|
|
623
531
|
return this;
|
|
624
532
|
};
|
|
625
|
-
|
|
626
533
|
Tween.prototype.stopChainedTweens = function () {
|
|
627
534
|
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
628
535
|
this._chainedTweens[i].stop();
|
|
629
536
|
}
|
|
630
|
-
|
|
631
537
|
return this;
|
|
632
538
|
};
|
|
633
|
-
|
|
634
539
|
Tween.prototype.group = function (group) {
|
|
635
540
|
this._group = group;
|
|
636
541
|
return this;
|
|
637
542
|
};
|
|
638
|
-
|
|
639
543
|
Tween.prototype.delay = function (amount) {
|
|
640
544
|
this._delayTime = amount;
|
|
641
545
|
return this;
|
|
642
546
|
};
|
|
643
|
-
|
|
644
547
|
Tween.prototype.repeat = function (times) {
|
|
645
548
|
this._initialRepeat = times;
|
|
646
549
|
this._repeat = times;
|
|
647
550
|
return this;
|
|
648
551
|
};
|
|
649
|
-
|
|
650
552
|
Tween.prototype.repeatDelay = function (amount) {
|
|
651
553
|
this._repeatDelayTime = amount;
|
|
652
554
|
return this;
|
|
653
555
|
};
|
|
654
|
-
|
|
655
556
|
Tween.prototype.yoyo = function (yoyo) {
|
|
656
557
|
this._yoyo = yoyo;
|
|
657
558
|
return this;
|
|
658
559
|
};
|
|
659
|
-
|
|
660
560
|
Tween.prototype.easing = function (easingFunction) {
|
|
661
561
|
this._easingFunction = easingFunction;
|
|
662
562
|
return this;
|
|
663
563
|
};
|
|
664
|
-
|
|
665
564
|
Tween.prototype.interpolation = function (interpolationFunction) {
|
|
666
565
|
this._interpolationFunction = interpolationFunction;
|
|
667
566
|
return this;
|
|
668
567
|
};
|
|
669
|
-
|
|
670
568
|
Tween.prototype.chain = function () {
|
|
671
569
|
var tweens = [];
|
|
672
|
-
|
|
673
570
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
674
571
|
tweens[_i] = arguments[_i];
|
|
675
572
|
}
|
|
676
|
-
|
|
677
573
|
this._chainedTweens = tweens;
|
|
678
574
|
return this;
|
|
679
575
|
};
|
|
680
|
-
|
|
681
576
|
Tween.prototype.onStart = function (callback) {
|
|
682
577
|
this._onStartCallback = callback;
|
|
683
578
|
return this;
|
|
684
579
|
};
|
|
685
|
-
|
|
686
580
|
Tween.prototype.onUpdate = function (callback) {
|
|
687
581
|
this._onUpdateCallback = callback;
|
|
688
582
|
return this;
|
|
689
583
|
};
|
|
690
|
-
|
|
691
584
|
Tween.prototype.onRepeat = function (callback) {
|
|
692
585
|
this._onRepeatCallback = callback;
|
|
693
586
|
return this;
|
|
694
587
|
};
|
|
695
|
-
|
|
696
588
|
Tween.prototype.onComplete = function (callback) {
|
|
697
589
|
this._onCompleteCallback = callback;
|
|
698
590
|
return this;
|
|
699
591
|
};
|
|
700
|
-
|
|
701
592
|
Tween.prototype.onStop = function (callback) {
|
|
702
593
|
this._onStopCallback = callback;
|
|
703
594
|
return this;
|
|
704
595
|
};
|
|
705
|
-
|
|
706
596
|
Tween.prototype.update = function (time, autoStart) {
|
|
707
597
|
if (time === void 0) {
|
|
708
598
|
time = now$1();
|
|
709
599
|
}
|
|
710
|
-
|
|
711
600
|
if (autoStart === void 0) {
|
|
712
601
|
autoStart = true;
|
|
713
602
|
}
|
|
714
|
-
|
|
715
603
|
if (this._isPaused) return true;
|
|
716
604
|
var property;
|
|
717
605
|
var elapsed;
|
|
718
606
|
var endTime = this._startTime + this._duration;
|
|
719
|
-
|
|
720
607
|
if (!this._goToEnd && !this._isPlaying) {
|
|
721
608
|
if (time > endTime) return false;
|
|
722
609
|
if (autoStart) this.start(time);
|
|
723
610
|
}
|
|
724
|
-
|
|
725
611
|
this._goToEnd = false;
|
|
726
|
-
|
|
727
612
|
if (time < this._startTime) {
|
|
728
613
|
return true;
|
|
729
614
|
}
|
|
730
|
-
|
|
731
615
|
if (this._onStartCallbackFired === false) {
|
|
732
616
|
if (this._onStartCallback) {
|
|
733
617
|
this._onStartCallback(this._object);
|
|
734
618
|
}
|
|
735
|
-
|
|
736
619
|
this._onStartCallbackFired = true;
|
|
737
620
|
}
|
|
738
|
-
|
|
739
621
|
elapsed = (time - this._startTime) / this._duration;
|
|
740
622
|
elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
|
|
741
|
-
|
|
742
623
|
var value = this._easingFunction(elapsed);
|
|
743
|
-
|
|
744
624
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
|
745
|
-
|
|
746
625
|
if (this._onUpdateCallback) {
|
|
747
626
|
this._onUpdateCallback(this._object, elapsed);
|
|
748
627
|
}
|
|
749
|
-
|
|
750
628
|
if (elapsed === 1) {
|
|
751
629
|
if (this._repeat > 0) {
|
|
752
630
|
if (isFinite(this._repeat)) {
|
|
753
631
|
this._repeat--;
|
|
754
632
|
}
|
|
755
|
-
|
|
756
633
|
for (property in this._valuesStartRepeat) {
|
|
757
634
|
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
|
758
|
-
this._valuesStartRepeat[property] =
|
|
635
|
+
this._valuesStartRepeat[property] =
|
|
636
|
+
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
|
759
637
|
}
|
|
760
|
-
|
|
761
638
|
if (this._yoyo) {
|
|
762
639
|
this._swapEndStartRepeatValues(property);
|
|
763
640
|
}
|
|
764
|
-
|
|
765
641
|
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
766
642
|
}
|
|
767
|
-
|
|
768
643
|
if (this._yoyo) {
|
|
769
644
|
this._reversed = !this._reversed;
|
|
770
645
|
}
|
|
771
|
-
|
|
772
646
|
if (this._repeatDelayTime !== undefined) {
|
|
773
647
|
this._startTime = time + this._repeatDelayTime;
|
|
774
648
|
} else {
|
|
775
649
|
this._startTime = time + this._delayTime;
|
|
776
650
|
}
|
|
777
|
-
|
|
778
651
|
if (this._onRepeatCallback) {
|
|
779
652
|
this._onRepeatCallback(this._object);
|
|
780
653
|
}
|
|
781
|
-
|
|
782
654
|
return true;
|
|
783
655
|
} else {
|
|
784
656
|
if (this._onCompleteCallback) {
|
|
785
657
|
this._onCompleteCallback(this._object);
|
|
786
658
|
}
|
|
787
|
-
|
|
788
659
|
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
789
660
|
this._chainedTweens[i].start(this._startTime + this._duration);
|
|
790
661
|
}
|
|
791
|
-
|
|
792
662
|
this._isPlaying = false;
|
|
793
663
|
return false;
|
|
794
664
|
}
|
|
795
665
|
}
|
|
796
|
-
|
|
797
666
|
return true;
|
|
798
667
|
};
|
|
799
|
-
|
|
800
668
|
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
|
801
669
|
for (var property in _valuesEnd) {
|
|
802
670
|
if (_valuesStart[property] === undefined) {
|
|
803
671
|
continue;
|
|
804
672
|
}
|
|
805
|
-
|
|
806
673
|
var start = _valuesStart[property] || 0;
|
|
807
674
|
var end = _valuesEnd[property];
|
|
808
675
|
var startIsArray = Array.isArray(_object[property]);
|
|
809
676
|
var endIsArray = Array.isArray(end);
|
|
810
677
|
var isInterpolationList = !startIsArray && endIsArray;
|
|
811
|
-
|
|
812
678
|
if (isInterpolationList) {
|
|
813
679
|
_object[property] = this._interpolationFunction(end, value);
|
|
814
680
|
} else if (typeof end === 'object' && end) {
|
|
815
681
|
this._updateProperties(_object[property], start, end, value);
|
|
816
682
|
} else {
|
|
817
683
|
end = this._handleRelativeValue(start, end);
|
|
818
|
-
|
|
819
684
|
if (typeof end === 'number') {
|
|
820
685
|
_object[property] = start + (end - start) * value;
|
|
821
686
|
}
|
|
822
687
|
}
|
|
823
688
|
}
|
|
824
689
|
};
|
|
825
|
-
|
|
826
690
|
Tween.prototype._handleRelativeValue = function (start, end) {
|
|
827
691
|
if (typeof end !== 'string') {
|
|
828
692
|
return end;
|
|
829
693
|
}
|
|
830
|
-
|
|
831
694
|
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
|
832
695
|
return start + parseFloat(end);
|
|
833
696
|
} else {
|
|
834
697
|
return parseFloat(end);
|
|
835
698
|
}
|
|
836
699
|
};
|
|
837
|
-
|
|
838
700
|
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
|
839
701
|
var tmp = this._valuesStartRepeat[property];
|
|
840
702
|
var endValue = this._valuesEnd[property];
|
|
841
|
-
|
|
842
703
|
if (typeof endValue === 'string') {
|
|
843
704
|
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
|
|
844
705
|
} else {
|
|
845
706
|
this._valuesStartRepeat[property] = this._valuesEnd[property];
|
|
846
707
|
}
|
|
847
|
-
|
|
848
708
|
this._valuesEnd[property] = tmp;
|
|
849
709
|
};
|
|
850
|
-
|
|
851
710
|
return Tween;
|
|
852
711
|
}();
|
|
853
712
|
|
|
713
|
+
Sequence.nextId;
|
|
854
714
|
var TWEEN = mainGroup;
|
|
855
715
|
TWEEN.getAll.bind(TWEEN);
|
|
856
716
|
TWEEN.removeAll.bind(TWEEN);
|
|
@@ -869,7 +729,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
869
729
|
return ~~p;
|
|
870
730
|
}
|
|
871
731
|
};
|
|
872
|
-
|
|
873
732
|
var Animation = function () {
|
|
874
733
|
function Animation(timelines, tweenGroup) {
|
|
875
734
|
this.tweens = [];
|
|
@@ -881,15 +740,12 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
881
740
|
this.timelines = timelines;
|
|
882
741
|
this.tweenGroup = tweenGroup;
|
|
883
742
|
}
|
|
884
|
-
|
|
885
743
|
Animation.prototype.on = function (eventName, callback) {
|
|
886
744
|
if (!this.callbacks[eventName]) {
|
|
887
745
|
this.callbacks.set(eventName, []);
|
|
888
746
|
}
|
|
889
|
-
|
|
890
747
|
this.callbacks.get(eventName).push(callback);
|
|
891
748
|
};
|
|
892
|
-
|
|
893
749
|
Animation.prototype.emit = function (eventName) {
|
|
894
750
|
var callbacks = this.callbacks.get(eventName);
|
|
895
751
|
if (!callbacks || !callbacks.length) return;
|
|
@@ -897,7 +753,6 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
897
753
|
return fn();
|
|
898
754
|
});
|
|
899
755
|
};
|
|
900
|
-
|
|
901
756
|
Animation.prototype.checkFinish = function () {
|
|
902
757
|
if (++this.finishCount == this.tweens.length) {
|
|
903
758
|
if (++this.currIteration == this.iteration) {
|
|
@@ -908,48 +763,37 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
908
763
|
}
|
|
909
764
|
}
|
|
910
765
|
};
|
|
911
|
-
|
|
912
766
|
Animation.prototype.getObjectCache = function (component, name) {
|
|
913
767
|
var key = "" + component.gameObject.id + component.name;
|
|
914
|
-
|
|
915
768
|
if (!this.objectCache[key]) {
|
|
916
769
|
this.objectCache[key] = {};
|
|
917
770
|
}
|
|
918
|
-
|
|
919
771
|
if (this.objectCache[key][name]) {
|
|
920
772
|
return this.objectCache[key][name];
|
|
921
773
|
}
|
|
922
|
-
|
|
923
774
|
var keys = name.split('.');
|
|
924
775
|
var keyIndex = keys.length - 1;
|
|
925
776
|
var property = component;
|
|
926
|
-
|
|
927
777
|
for (var i = 0; i < keyIndex; i++) {
|
|
928
778
|
property = property[keys[i]];
|
|
929
779
|
}
|
|
930
|
-
|
|
931
780
|
this.objectCache[key][name] = {
|
|
932
781
|
property: property,
|
|
933
782
|
key: keys[keyIndex]
|
|
934
783
|
};
|
|
935
784
|
return this.objectCache[key][name];
|
|
936
785
|
};
|
|
937
|
-
|
|
938
786
|
Animation.prototype.doAnim = function (_a) {
|
|
939
787
|
var component = _a.component,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
788
|
+
name = _a.name,
|
|
789
|
+
value = _a.value;
|
|
943
790
|
var _b = this.getObjectCache(component, name),
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
791
|
+
property = _b.property,
|
|
792
|
+
key = _b.key;
|
|
947
793
|
property[key] = value;
|
|
948
794
|
};
|
|
949
|
-
|
|
950
795
|
Animation.prototype.init = function () {
|
|
951
796
|
var _this = this;
|
|
952
|
-
|
|
953
797
|
this.checkFinishFunc = this.checkFinish.bind(this);
|
|
954
798
|
var lastTween;
|
|
955
799
|
this.timelines.forEach(function (timeline, i) {
|
|
@@ -967,37 +811,30 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
967
811
|
value: props.value
|
|
968
812
|
});
|
|
969
813
|
});
|
|
970
|
-
|
|
971
814
|
if (j === 0) {
|
|
972
815
|
_this.tweens[i] = tween;
|
|
973
816
|
} else {
|
|
974
817
|
lastTween.chain(tween);
|
|
975
818
|
}
|
|
976
|
-
|
|
977
819
|
lastTween = tween;
|
|
978
820
|
}
|
|
979
|
-
|
|
980
821
|
lastTween && lastTween.onComplete(function () {
|
|
981
822
|
return _this.checkFinishFunc();
|
|
982
823
|
});
|
|
983
824
|
});
|
|
984
825
|
};
|
|
985
|
-
|
|
986
826
|
Animation.prototype.play = function (iteration, currentTime) {
|
|
987
827
|
if (iteration === void 0) {
|
|
988
828
|
iteration = 1;
|
|
989
829
|
}
|
|
990
|
-
|
|
991
830
|
this.currentTime = currentTime;
|
|
992
831
|
this.stoped = false;
|
|
993
832
|
this.start();
|
|
994
833
|
this.currIteration = 0;
|
|
995
834
|
this.iteration = iteration;
|
|
996
835
|
};
|
|
997
|
-
|
|
998
836
|
Animation.prototype.start = function () {
|
|
999
837
|
var _this = this;
|
|
1000
|
-
|
|
1001
838
|
this.finishCount = 0;
|
|
1002
839
|
this.tweens.length = 0;
|
|
1003
840
|
this.init();
|
|
@@ -1005,30 +842,24 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1005
842
|
return tween.start(_this.currentTime);
|
|
1006
843
|
});
|
|
1007
844
|
};
|
|
1008
|
-
|
|
1009
845
|
Animation.prototype.pause = function () {
|
|
1010
846
|
var _this = this;
|
|
1011
|
-
|
|
1012
847
|
this.tweens.forEach(function (tween) {
|
|
1013
848
|
return tween.pause(_this.currentTime);
|
|
1014
849
|
});
|
|
1015
850
|
};
|
|
1016
|
-
|
|
1017
851
|
Animation.prototype.resume = function () {
|
|
1018
852
|
var _this = this;
|
|
1019
|
-
|
|
1020
853
|
this.tweens.forEach(function (tween) {
|
|
1021
854
|
return tween.resume(_this.currentTime);
|
|
1022
855
|
});
|
|
1023
856
|
};
|
|
1024
|
-
|
|
1025
857
|
Animation.prototype.stop = function () {
|
|
1026
858
|
this.stoped = true;
|
|
1027
859
|
this.tweens.forEach(function (tween) {
|
|
1028
860
|
return tween.stop();
|
|
1029
861
|
});
|
|
1030
862
|
};
|
|
1031
|
-
|
|
1032
863
|
Animation.prototype.destroy = function () {
|
|
1033
864
|
this.stop();
|
|
1034
865
|
this.tweens = null;
|
|
@@ -1037,25 +868,19 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1037
868
|
this.callbacks.clear();
|
|
1038
869
|
this.callbacks = null;
|
|
1039
870
|
};
|
|
1040
|
-
|
|
1041
871
|
return Animation;
|
|
1042
872
|
}();
|
|
1043
|
-
|
|
1044
873
|
var Animation$1 = Animation;
|
|
1045
|
-
|
|
1046
874
|
var Transition = function (_super) {
|
|
1047
875
|
__extends(Transition, _super);
|
|
1048
|
-
|
|
1049
876
|
function Transition() {
|
|
1050
877
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1051
|
-
|
|
1052
878
|
_this.animations = {};
|
|
1053
879
|
_this.group = {};
|
|
1054
880
|
_this.currentTime = 0;
|
|
1055
881
|
_this.needPlay = [];
|
|
1056
882
|
return _this;
|
|
1057
883
|
}
|
|
1058
|
-
|
|
1059
884
|
Transition.prototype.init = function (_a) {
|
|
1060
885
|
var group = (_a === void 0 ? {
|
|
1061
886
|
group: {}
|
|
@@ -1063,22 +888,18 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1063
888
|
this.group = group;
|
|
1064
889
|
this.tweenGroup = new Group();
|
|
1065
890
|
};
|
|
1066
|
-
|
|
1067
891
|
Transition.prototype.awake = function () {
|
|
1068
892
|
for (var name_1 in this.group) {
|
|
1069
893
|
this.newAnimation(name_1);
|
|
1070
894
|
}
|
|
1071
895
|
};
|
|
1072
|
-
|
|
1073
896
|
Transition.prototype.play = function (name, iteration) {
|
|
1074
897
|
if (!name) {
|
|
1075
898
|
name = Object.keys(this.group)[0];
|
|
1076
899
|
}
|
|
1077
|
-
|
|
1078
900
|
if (name && !this.animations[name] && this.group[name]) {
|
|
1079
901
|
this.newAnimation(name);
|
|
1080
902
|
}
|
|
1081
|
-
|
|
1082
903
|
if (name && this.animations[name]) {
|
|
1083
904
|
this.needPlay.push({
|
|
1084
905
|
name: name,
|
|
@@ -1086,10 +907,8 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1086
907
|
});
|
|
1087
908
|
}
|
|
1088
909
|
};
|
|
1089
|
-
|
|
1090
910
|
Transition.prototype.stop = function (name) {
|
|
1091
911
|
var _a, _b;
|
|
1092
|
-
|
|
1093
912
|
if (!name) {
|
|
1094
913
|
for (var key in this.animations) {
|
|
1095
914
|
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.stop();
|
|
@@ -1098,50 +917,37 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1098
917
|
(_b = this.animations[name]) === null || _b === void 0 ? void 0 : _b.stop();
|
|
1099
918
|
}
|
|
1100
919
|
};
|
|
1101
|
-
|
|
1102
920
|
Transition.prototype.onPause = function () {
|
|
1103
921
|
var _a;
|
|
1104
|
-
|
|
1105
922
|
for (var key in this.animations) {
|
|
1106
923
|
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.pause();
|
|
1107
924
|
}
|
|
1108
925
|
};
|
|
1109
|
-
|
|
1110
926
|
Transition.prototype.onResume = function () {
|
|
1111
927
|
var _a;
|
|
1112
|
-
|
|
1113
928
|
for (var key in this.animations) {
|
|
1114
929
|
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.resume();
|
|
1115
930
|
}
|
|
1116
931
|
};
|
|
1117
|
-
|
|
1118
932
|
Transition.prototype.onDestroy = function () {
|
|
1119
933
|
var _a;
|
|
1120
|
-
|
|
1121
934
|
for (var key in this.animations) {
|
|
1122
935
|
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1123
936
|
}
|
|
1124
|
-
|
|
1125
937
|
this.tweenGroup.removeAll();
|
|
1126
938
|
this.tweenGroup = null;
|
|
1127
939
|
this.group = null;
|
|
1128
940
|
this.animations = null;
|
|
1129
941
|
this.removeAllListeners();
|
|
1130
942
|
};
|
|
1131
|
-
|
|
1132
943
|
Transition.prototype.update = function (e) {
|
|
1133
944
|
var e_1, _a;
|
|
1134
|
-
|
|
1135
945
|
var _b;
|
|
1136
|
-
|
|
1137
946
|
this.currentTime = e.time;
|
|
1138
|
-
|
|
1139
947
|
for (var key in this.animations) {
|
|
1140
948
|
this.animations[key].currentTime = e.time;
|
|
1141
949
|
}
|
|
1142
|
-
|
|
1143
950
|
this.tweenGroup.update(e.time);
|
|
1144
|
-
|
|
1145
951
|
try {
|
|
1146
952
|
for (var _c = __values(this.needPlay), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1147
953
|
var play = _d.value;
|
|
@@ -1158,40 +964,30 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1158
964
|
if (e_1) throw e_1.error;
|
|
1159
965
|
}
|
|
1160
966
|
}
|
|
1161
|
-
|
|
1162
967
|
this.needPlay.length = 0;
|
|
1163
968
|
};
|
|
1164
|
-
|
|
1165
969
|
Transition.prototype.newAnimation = function (name) {
|
|
1166
970
|
var _this = this;
|
|
1167
|
-
|
|
1168
971
|
var animation = new Animation$1(this.group[name], this.tweenGroup);
|
|
1169
972
|
animation.on('finish', function () {
|
|
1170
973
|
return _this.emit('finish', name);
|
|
1171
974
|
});
|
|
1172
975
|
this.animations[name] = animation;
|
|
1173
976
|
};
|
|
1174
|
-
|
|
1175
977
|
Transition.componentName = 'Transition';
|
|
1176
978
|
return Transition;
|
|
1177
979
|
}(eva_js.Component);
|
|
1178
|
-
|
|
1179
980
|
var Transition$1 = Transition;
|
|
1180
|
-
|
|
1181
981
|
var TransitionSystem = function (_super) {
|
|
1182
982
|
__extends(TransitionSystem, _super);
|
|
1183
|
-
|
|
1184
983
|
function TransitionSystem() {
|
|
1185
984
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1186
|
-
|
|
1187
985
|
_this.name = 'transition';
|
|
1188
986
|
return _this;
|
|
1189
987
|
}
|
|
1190
|
-
|
|
1191
988
|
TransitionSystem.systemName = 'transition';
|
|
1192
989
|
return TransitionSystem;
|
|
1193
990
|
}(eva_js.System);
|
|
1194
|
-
|
|
1195
991
|
var TransitionSystem$1 = TransitionSystem;
|
|
1196
992
|
exports.Transition = Transition$1;
|
|
1197
993
|
exports.TransitionSystem = TransitionSystem$1;
|
|
@@ -1200,5 +996,4 @@ var _EVA_IIFE_transition = function (exports, eva_js) {
|
|
|
1200
996
|
});
|
|
1201
997
|
return exports;
|
|
1202
998
|
}({}, EVA);
|
|
1203
|
-
|
|
1204
999
|
window.EVA.plugin.transition = window.EVA.plugin.transition || _EVA_IIFE_transition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_transition=function(t,e){"use strict";var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r,o={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-o.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*o.Bounce.In(2*t):.5*o.Bounce.Out(2*t-1)+.5}}},s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},a=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=s()),void 0===e&&(e=!1);var i=Object.keys(this._tweens);if(0===i.length)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var r=this._tweens[i[n]],o=!e;r&&!1===r.update(t,o)&&!e&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),u={Linear:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,o=u.Utils.Bernstein,s=0;s<=n;s++)i+=r(1-e,n-s)*r(e,s)*t[s]*o(n,s);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),o(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):o(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=u.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}),CatmullRom:function(t,e,i,n,r){var o=.5*(i-t),s=.5*(n-e),a=r*r;return(2*e-2*i+o+s)*(r*a)+(-3*e+3*i-2*o-s)*a+o*r+e}}},h=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),p=new a,c=function(){function t(t,e){void 0===e&&(e=p),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=o.Linear.None,this._interpolationFunction=u.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=h.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?s()+parseFloat(t):t:s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,i,n){for(var r in i){var o=t[r],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(i[r]);if("undefined"!==a&&"function"!==a){if(u){var h=i[r];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(h)}if("object"!==a&&!s||!o||u)void 0===e[r]&&(e[r]=o),s||(e[r]*=1),n[r]=u?i[r].slice().reverse():e[r]||0;else{for(var p in e[r]=s?[]:{},o)e[r][p]=o[p];n[r]=s?[]:{},this._setupProperties(o,e[r],i[r],n[r])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=s()),void 0===e&&(e=!0),this._isPaused)return!0;var i,n,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(t-this._startTime)/this._duration,n=0===this._duration||n>1?1:n;var o=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(i in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,i,n){for(var r in i)if(void 0!==e[r]){var o=e[r]||0,s=i[r],a=Array.isArray(t[r]),u=Array.isArray(s);!a&&u?t[r]=this._interpolationFunction(s,n):"object"==typeof s&&s?this._updateProperties(t[r],o,s,n):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[r]=o+(s-o)*n)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof i?this._valuesStartRepeat[t]+parseFloat(i):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),l=p;l.getAll.bind(l),l.removeAll.bind(l),l.add.bind(l),l.remove.bind(l),l.update.bind(l);var f={linear:o.Linear.None,"ease-in":o.Quadratic.In,"ease-out":o.Quadratic.Out,"ease-in-out":o.Quadratic.InOut,"bounce-in":o.Bounce.In,"bounce-out":o.Bounce.Out,"bounce-in-out":o.Bounce.InOut,none:function(t){return~~t}},_=function(){function t(t,e){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=e}return t.prototype.on=function(t,e){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)},t.prototype.emit=function(t){var e=this.callbacks.get(t);e&&e.length&&e.forEach((function(t){return t()}))},t.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},t.prototype.getObjectCache=function(t,e){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][e])return this.objectCache[i][e];for(var n=e.split("."),r=n.length-1,o=t,s=0;s<r;s++)o=o[n[s]];return this.objectCache[i][e]={property:o,key:n[r]},this.objectCache[i][e]},t.prototype.doAnim=function(t){var e=t.component,i=t.name,n=t.value,r=this.getObjectCache(e,i);r.property[r.key]=n},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(i,n){for(var r=0;r<i.values.length-1;r++){var o=i.values[r],s=i.values[r+1],a=new c({value:o.value},e.tweenGroup).to({value:s.value}).duration(s.time-o.time).easing(f[o.tween]).onUpdate((function(t){e.doAnim({component:i.component,name:i.name,value:t.value})}));0===r?e.tweens[n]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t,e){void 0===t&&(t=1),this.currentTime=e,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(e){return e.start(t.currentTime)}))},t.prototype.pause=function(){var t=this;this.tweens.forEach((function(e){return e.pause(t.currentTime)}))},t.prototype.resume=function(){var t=this;this.tweens.forEach((function(e){return e.resume(t.currentTime)}))},t.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},t.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},t}(),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.animations={},e.group={},e.currentTime=0,e.needPlay=[],e}return n(e,t),e.prototype.init=function(t){var e=(void 0===t?{group:{}}:t).group;this.group=e,this.tweenGroup=new a},e.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},e.prototype.play=function(t,e){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.needPlay.push({name:t,iteration:e})},e.prototype.stop=function(t){var e,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var n in this.animations)null===(e=this.animations[n])||void 0===e||e.stop()},e.prototype.onPause=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.pause()},e.prototype.onResume=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.resume()},e.prototype.onDestroy=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(t){var e,i,n;for(var r in this.currentTime=t.time,this.animations)this.animations[r].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.needPlay),s=o.next();!s.done;s=o.next()){var a=s.value;null===(n=this.animations[a.name])||void 0===n||n.play(a.iteration,this.currentTime)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this.needPlay.length=0},e.prototype.newAnimation=function(t){var e=this,i=new _(this.group[t],this.tweenGroup);i.on("finish",(function(){return e.emit("finish",t)})),this.animations[t]=i},e.componentName="Transition",e}(e.Component),y=d,v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="transition",e}return n(e,t),e.systemName="transition",e}(e.System),m=v;return t.Transition=y,t.TransitionSystem=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.transition=window.EVA.plugin.transition||_EVA_IIFE_transition;
|
|
1
|
+
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_transition=function(t,e){"use strict";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},n(t,e)};function i(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r,o={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-o.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*o.Bounce.In(2*t):.5*o.Bounce.Out(2*t-1)+.5}}},s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},a=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=s()),void 0===e&&(e=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],o=!e;r&&!1===r.update(t,o)&&!e&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),u={Linear:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),o=u.Utils.Linear;return e<0?o(t[0],t[1],i):e>1?o(t[n],t[n-1],n-i):o(t[r],t[r+1>n?n:r+1],i-r)},Bezier:function(t,e){for(var n=0,i=t.length-1,r=Math.pow,o=u.Utils.Bernstein,s=0;s<=i;s++)n+=r(1-e,i-s)*r(e,s)*t[s]*o(i,s);return n},CatmullRom:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),o=u.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(r=Math.floor(i=n*(1+e))),o(t[(r-1+n)%n],t[r],t[(r+1)%n],t[(r+2)%n],i-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],i-n)-t[n]):o(t[r?r-1:0],t[r],t[n<r+1?n:r+1],t[n<r+2?n:r+2],i-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=u.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var n=t;n>1;n--)e*=n;return r[t]=e,e}),CatmullRom:function(t,e,n,i,r){var o=.5*(n-t),s=.5*(i-e),a=r*r;return(2*e-2*n+o+s)*(r*a)+(-3*e+3*n-2*o-s)*a+o*r+e}}},h=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),p=new a,c=function(){function t(t,e){void 0===e&&(e=p),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=o.Linear.None,this._interpolationFunction=u.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=h.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?s()+parseFloat(t):t:s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,n,i){for(var r in n){var o=t[r],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(u){var h=n[r];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,o)),n[r]=[o].concat(h)}if("object"!==a&&!s||!o||u)void 0===e[r]&&(e[r]=o),s||(e[r]*=1),i[r]=u?n[r].slice().reverse():e[r]||0;else{for(var p in e[r]=s?[]:{},o)e[r][p]=o[p];i[r]=s?[]:{},this._setupProperties(o,e[r],n[r],i[r])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=s()),void 0===e&&(e=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(t-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var o=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,n,i){for(var r in n)if(void 0!==e[r]){var o=e[r]||0,s=n[r],a=Array.isArray(t[r]),u=Array.isArray(s);!a&&u?t[r]=this._interpolationFunction(s,i):"object"==typeof s&&s?this._updateProperties(t[r],o,s,i):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[r]=o+(s-o)*i)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof n?this._valuesStartRepeat[t]+parseFloat(n):this._valuesEnd[t],this._valuesEnd[t]=e},t}();h.nextId;var l=p;l.getAll.bind(l),l.removeAll.bind(l),l.add.bind(l),l.remove.bind(l),l.update.bind(l);var f={linear:o.Linear.None,"ease-in":o.Quadratic.In,"ease-out":o.Quadratic.Out,"ease-in-out":o.Quadratic.InOut,"bounce-in":o.Bounce.In,"bounce-out":o.Bounce.Out,"bounce-in-out":o.Bounce.InOut,none:function(t){return~~t}},_=function(){function t(t,e){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=e}return t.prototype.on=function(t,e){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)},t.prototype.emit=function(t){var e=this.callbacks.get(t);e&&e.length&&e.forEach((function(t){return t()}))},t.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},t.prototype.getObjectCache=function(t,e){var n=""+t.gameObject.id+t.name;if(this.objectCache[n]||(this.objectCache[n]={}),this.objectCache[n][e])return this.objectCache[n][e];for(var i=e.split("."),r=i.length-1,o=t,s=0;s<r;s++)o=o[i[s]];return this.objectCache[n][e]={property:o,key:i[r]},this.objectCache[n][e]},t.prototype.doAnim=function(t){var e=t.component,n=t.name,i=t.value,r=this.getObjectCache(e,n);r.property[r.key]=i},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(n,i){for(var r=0;r<n.values.length-1;r++){var o=n.values[r],s=n.values[r+1],a=new c({value:o.value},e.tweenGroup).to({value:s.value}).duration(s.time-o.time).easing(f[o.tween]).onUpdate((function(t){e.doAnim({component:n.component,name:n.name,value:t.value})}));0===r?e.tweens[i]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t,e){void 0===t&&(t=1),this.currentTime=e,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(e){return e.start(t.currentTime)}))},t.prototype.pause=function(){var t=this;this.tweens.forEach((function(e){return e.pause(t.currentTime)}))},t.prototype.resume=function(){var t=this;this.tweens.forEach((function(e){return e.resume(t.currentTime)}))},t.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},t.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},t}(),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.animations={},e.group={},e.currentTime=0,e.needPlay=[],e}return i(e,t),e.prototype.init=function(t){var e=(void 0===t?{group:{}}:t).group;this.group=e,this.tweenGroup=new a},e.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},e.prototype.play=function(t,e){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.needPlay.push({name:t,iteration:e})},e.prototype.stop=function(t){var e,n;if(t)null===(n=this.animations[t])||void 0===n||n.stop();else for(var i in this.animations)null===(e=this.animations[i])||void 0===e||e.stop()},e.prototype.onPause=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.pause()},e.prototype.onResume=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.resume()},e.prototype.onDestroy=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(t){var e,n,i;for(var r in this.currentTime=t.time,this.animations)this.animations[r].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.needPlay),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=this.animations[a.name])||void 0===i||i.play(a.iteration,this.currentTime)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}this.needPlay.length=0},e.prototype.newAnimation=function(t){var e=this,n=new _(this.group[t],this.tweenGroup);n.on("finish",(function(){return e.emit("finish",t)})),this.animations[t]=n},e.componentName="Transition",e}(e.Component),y=d,v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="transition",e}return i(e,t),e.systemName="transition",e}(e.System),m=v;return t.Transition=y,t.TransitionSystem=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.transition=window.EVA.plugin.transition||_EVA_IIFE_transition;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { __extends, __values } from 'tslib';
|
|
2
|
+
import { Easing, Tween, Group } from '@tweenjs/tween.js';
|
|
3
|
+
import { Component, System } from '@eva/eva.js/dist/miniprogram';
|
|
4
|
+
var easingMap = {
|
|
5
|
+
linear: Easing.Linear.None,
|
|
6
|
+
'ease-in': Easing.Quadratic.In,
|
|
7
|
+
'ease-out': Easing.Quadratic.Out,
|
|
8
|
+
'ease-in-out': Easing.Quadratic.InOut,
|
|
9
|
+
'bounce-in': Easing.Bounce.In,
|
|
10
|
+
'bounce-out': Easing.Bounce.Out,
|
|
11
|
+
'bounce-in-out': Easing.Bounce.InOut,
|
|
12
|
+
none: function none(p) {
|
|
13
|
+
return ~~p;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var Animation = function () {
|
|
17
|
+
function Animation(timelines, tweenGroup) {
|
|
18
|
+
this.tweens = [];
|
|
19
|
+
this.timelines = [];
|
|
20
|
+
this.finishCount = 0;
|
|
21
|
+
this.callbacks = new Map();
|
|
22
|
+
this.objectCache = {};
|
|
23
|
+
this.currIteration = 0;
|
|
24
|
+
this.timelines = timelines;
|
|
25
|
+
this.tweenGroup = tweenGroup;
|
|
26
|
+
}
|
|
27
|
+
Animation.prototype.on = function (eventName, callback) {
|
|
28
|
+
if (!this.callbacks[eventName]) {
|
|
29
|
+
this.callbacks.set(eventName, []);
|
|
30
|
+
}
|
|
31
|
+
this.callbacks.get(eventName).push(callback);
|
|
32
|
+
};
|
|
33
|
+
Animation.prototype.emit = function (eventName) {
|
|
34
|
+
var callbacks = this.callbacks.get(eventName);
|
|
35
|
+
if (!callbacks || !callbacks.length) return;
|
|
36
|
+
callbacks.forEach(function (fn) {
|
|
37
|
+
return fn();
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
Animation.prototype.checkFinish = function () {
|
|
41
|
+
if (++this.finishCount == this.tweens.length) {
|
|
42
|
+
if (++this.currIteration == this.iteration) {
|
|
43
|
+
this.emit('finish');
|
|
44
|
+
} else {
|
|
45
|
+
if (this.stoped) return;
|
|
46
|
+
this.start();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
Animation.prototype.getObjectCache = function (component, name) {
|
|
51
|
+
var key = "" + component.gameObject.id + component.name;
|
|
52
|
+
if (!this.objectCache[key]) {
|
|
53
|
+
this.objectCache[key] = {};
|
|
54
|
+
}
|
|
55
|
+
if (this.objectCache[key][name]) {
|
|
56
|
+
return this.objectCache[key][name];
|
|
57
|
+
}
|
|
58
|
+
var keys = name.split('.');
|
|
59
|
+
var keyIndex = keys.length - 1;
|
|
60
|
+
var property = component;
|
|
61
|
+
for (var i = 0; i < keyIndex; i++) {
|
|
62
|
+
property = property[keys[i]];
|
|
63
|
+
}
|
|
64
|
+
this.objectCache[key][name] = {
|
|
65
|
+
property: property,
|
|
66
|
+
key: keys[keyIndex]
|
|
67
|
+
};
|
|
68
|
+
return this.objectCache[key][name];
|
|
69
|
+
};
|
|
70
|
+
Animation.prototype.doAnim = function (_a) {
|
|
71
|
+
var component = _a.component,
|
|
72
|
+
name = _a.name,
|
|
73
|
+
value = _a.value;
|
|
74
|
+
var _b = this.getObjectCache(component, name),
|
|
75
|
+
property = _b.property,
|
|
76
|
+
key = _b.key;
|
|
77
|
+
property[key] = value;
|
|
78
|
+
};
|
|
79
|
+
Animation.prototype.init = function () {
|
|
80
|
+
var _this = this;
|
|
81
|
+
this.checkFinishFunc = this.checkFinish.bind(this);
|
|
82
|
+
var lastTween;
|
|
83
|
+
this.timelines.forEach(function (timeline, i) {
|
|
84
|
+
for (var j = 0; j < timeline.values.length - 1; j++) {
|
|
85
|
+
var frame = timeline.values[j];
|
|
86
|
+
var nextFrame = timeline.values[j + 1];
|
|
87
|
+
var tween = new Tween({
|
|
88
|
+
value: frame.value
|
|
89
|
+
}, _this.tweenGroup).to({
|
|
90
|
+
value: nextFrame.value
|
|
91
|
+
}).duration(nextFrame.time - frame.time).easing(easingMap[frame.tween]).onUpdate(function (props) {
|
|
92
|
+
_this.doAnim({
|
|
93
|
+
component: timeline.component,
|
|
94
|
+
name: timeline.name,
|
|
95
|
+
value: props.value
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
if (j === 0) {
|
|
99
|
+
_this.tweens[i] = tween;
|
|
100
|
+
} else {
|
|
101
|
+
lastTween.chain(tween);
|
|
102
|
+
}
|
|
103
|
+
lastTween = tween;
|
|
104
|
+
}
|
|
105
|
+
lastTween && lastTween.onComplete(function () {
|
|
106
|
+
return _this.checkFinishFunc();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
Animation.prototype.play = function (iteration, currentTime) {
|
|
111
|
+
if (iteration === void 0) {
|
|
112
|
+
iteration = 1;
|
|
113
|
+
}
|
|
114
|
+
this.currentTime = currentTime;
|
|
115
|
+
this.stoped = false;
|
|
116
|
+
this.start();
|
|
117
|
+
this.currIteration = 0;
|
|
118
|
+
this.iteration = iteration;
|
|
119
|
+
};
|
|
120
|
+
Animation.prototype.start = function () {
|
|
121
|
+
var _this = this;
|
|
122
|
+
this.finishCount = 0;
|
|
123
|
+
this.tweens.length = 0;
|
|
124
|
+
this.init();
|
|
125
|
+
this.tweens.forEach(function (tween) {
|
|
126
|
+
return tween.start(_this.currentTime);
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
Animation.prototype.pause = function () {
|
|
130
|
+
var _this = this;
|
|
131
|
+
this.tweens.forEach(function (tween) {
|
|
132
|
+
return tween.pause(_this.currentTime);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
Animation.prototype.resume = function () {
|
|
136
|
+
var _this = this;
|
|
137
|
+
this.tweens.forEach(function (tween) {
|
|
138
|
+
return tween.resume(_this.currentTime);
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
Animation.prototype.stop = function () {
|
|
142
|
+
this.stoped = true;
|
|
143
|
+
this.tweens.forEach(function (tween) {
|
|
144
|
+
return tween.stop();
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
Animation.prototype.destroy = function () {
|
|
148
|
+
this.stop();
|
|
149
|
+
this.tweens = null;
|
|
150
|
+
this.timelines = null;
|
|
151
|
+
this.objectCache = null;
|
|
152
|
+
this.callbacks.clear();
|
|
153
|
+
this.callbacks = null;
|
|
154
|
+
};
|
|
155
|
+
return Animation;
|
|
156
|
+
}();
|
|
157
|
+
var Animation$1 = Animation;
|
|
158
|
+
var Transition = function (_super) {
|
|
159
|
+
__extends(Transition, _super);
|
|
160
|
+
function Transition() {
|
|
161
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
162
|
+
_this.animations = {};
|
|
163
|
+
_this.group = {};
|
|
164
|
+
_this.currentTime = 0;
|
|
165
|
+
_this.needPlay = [];
|
|
166
|
+
return _this;
|
|
167
|
+
}
|
|
168
|
+
Transition.prototype.init = function (_a) {
|
|
169
|
+
var group = (_a === void 0 ? {
|
|
170
|
+
group: {}
|
|
171
|
+
} : _a).group;
|
|
172
|
+
this.group = group;
|
|
173
|
+
this.tweenGroup = new Group();
|
|
174
|
+
};
|
|
175
|
+
Transition.prototype.awake = function () {
|
|
176
|
+
for (var name_1 in this.group) {
|
|
177
|
+
this.newAnimation(name_1);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
Transition.prototype.play = function (name, iteration) {
|
|
181
|
+
if (!name) {
|
|
182
|
+
name = Object.keys(this.group)[0];
|
|
183
|
+
}
|
|
184
|
+
if (name && !this.animations[name] && this.group[name]) {
|
|
185
|
+
this.newAnimation(name);
|
|
186
|
+
}
|
|
187
|
+
if (name && this.animations[name]) {
|
|
188
|
+
this.needPlay.push({
|
|
189
|
+
name: name,
|
|
190
|
+
iteration: iteration
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
Transition.prototype.stop = function (name) {
|
|
195
|
+
var _a, _b;
|
|
196
|
+
if (!name) {
|
|
197
|
+
for (var key in this.animations) {
|
|
198
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.stop();
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
(_b = this.animations[name]) === null || _b === void 0 ? void 0 : _b.stop();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
Transition.prototype.onPause = function () {
|
|
205
|
+
var _a;
|
|
206
|
+
for (var key in this.animations) {
|
|
207
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.pause();
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
Transition.prototype.onResume = function () {
|
|
211
|
+
var _a;
|
|
212
|
+
for (var key in this.animations) {
|
|
213
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.resume();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
Transition.prototype.onDestroy = function () {
|
|
217
|
+
var _a;
|
|
218
|
+
for (var key in this.animations) {
|
|
219
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
220
|
+
}
|
|
221
|
+
this.tweenGroup.removeAll();
|
|
222
|
+
this.tweenGroup = null;
|
|
223
|
+
this.group = null;
|
|
224
|
+
this.animations = null;
|
|
225
|
+
this.removeAllListeners();
|
|
226
|
+
};
|
|
227
|
+
Transition.prototype.update = function (e) {
|
|
228
|
+
var e_1, _a;
|
|
229
|
+
var _b;
|
|
230
|
+
this.currentTime = e.time;
|
|
231
|
+
for (var key in this.animations) {
|
|
232
|
+
this.animations[key].currentTime = e.time;
|
|
233
|
+
}
|
|
234
|
+
this.tweenGroup.update(e.time);
|
|
235
|
+
try {
|
|
236
|
+
for (var _c = __values(this.needPlay), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
237
|
+
var play = _d.value;
|
|
238
|
+
(_b = this.animations[play.name]) === null || _b === void 0 ? void 0 : _b.play(play.iteration, this.currentTime);
|
|
239
|
+
}
|
|
240
|
+
} catch (e_1_1) {
|
|
241
|
+
e_1 = {
|
|
242
|
+
error: e_1_1
|
|
243
|
+
};
|
|
244
|
+
} finally {
|
|
245
|
+
try {
|
|
246
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
247
|
+
} finally {
|
|
248
|
+
if (e_1) throw e_1.error;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
this.needPlay.length = 0;
|
|
252
|
+
};
|
|
253
|
+
Transition.prototype.newAnimation = function (name) {
|
|
254
|
+
var _this = this;
|
|
255
|
+
var animation = new Animation$1(this.group[name], this.tweenGroup);
|
|
256
|
+
animation.on('finish', function () {
|
|
257
|
+
return _this.emit('finish', name);
|
|
258
|
+
});
|
|
259
|
+
this.animations[name] = animation;
|
|
260
|
+
};
|
|
261
|
+
Transition.componentName = 'Transition';
|
|
262
|
+
return Transition;
|
|
263
|
+
}(Component);
|
|
264
|
+
var Transition$1 = Transition;
|
|
265
|
+
var TransitionSystem = function (_super) {
|
|
266
|
+
__extends(TransitionSystem, _super);
|
|
267
|
+
function TransitionSystem() {
|
|
268
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
269
|
+
_this.name = 'transition';
|
|
270
|
+
return _this;
|
|
271
|
+
}
|
|
272
|
+
TransitionSystem.systemName = 'transition';
|
|
273
|
+
return TransitionSystem;
|
|
274
|
+
}(System);
|
|
275
|
+
var TransitionSystem$1 = TransitionSystem;
|
|
276
|
+
export { Transition$1 as Transition, TransitionSystem$1 as TransitionSystem };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-transition",
|
|
3
|
-
"version": "1.2.7-
|
|
3
|
+
"version": "1.2.7-fix.4",
|
|
4
4
|
"description": "@eva/plugin-transition",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-transition.esm.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/eva.js": "1.2.7-
|
|
21
|
+
"@eva/eva.js": "1.2.7-fix.4",
|
|
22
22
|
"@tweenjs/tween.js": "^18.6.4",
|
|
23
23
|
"sprite-timeline": "^1.10.2"
|
|
24
24
|
}
|