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