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