safex-webgl 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/easing/Back.d.ts +7 -64
- package/dist/actions/easing/Back.d.ts.map +1 -1
- package/dist/actions/easing/Back.js +10 -52
- package/dist/actions/easing/Back.js.map +1 -1
- package/dist/actions/easing/Bounce.d.ts +3 -18
- package/dist/actions/easing/Bounce.d.ts.map +1 -1
- package/dist/actions/easing/Bounce.js +6 -6
- package/dist/actions/easing/Bounce.js.map +1 -1
- package/dist/mesh/MeshNode.js +1 -1
- package/package.json +1 -1
- package/dist/actions/ActionEase.d.ts +0 -1298
- package/dist/actions/ActionEase.d.ts.map +0 -1
- package/dist/actions/ActionEase.js +0 -2767
- package/dist/core/DirectorWebGL.js +0 -10
- package/dist/core/labelttf/LabelTTFCacheRenderCmd.d.ts +0 -5
- package/dist/core/labelttf/LabelTTFCacheRenderCmd.d.ts.map +0 -1
- package/dist/core/labelttf/LabelTTFCacheRenderCmd.js +0 -67
- package/dist/core/labelttf/LabelTTFRenderCmd.d.ts +0 -2
- package/dist/core/labelttf/LabelTTFRenderCmd.d.ts.map +0 -1
- package/dist/core/labelttf/LabelTTFRenderCmd.js +0 -305
- package/dist/particle/ParticleExamples.d.ts +0 -27
- package/dist/particle/ParticleExamples.d.ts.map +0 -1
- package/dist/particle/ParticleExamples.js +0 -839
- package/dist/textures/WebGLTextureAtlas.js +0 -5
- package/dist/ui/base/ProtectedNodeRenderCmd.d.ts +0 -6
- package/dist/ui/base/ProtectedNodeRenderCmd.d.ts.map +0 -1
- package/dist/ui/base/ProtectedNodeRenderCmd.js +0 -110
|
@@ -1,2767 +0,0 @@
|
|
|
1
|
-
import { log } from "../helper/Debugger";
|
|
2
|
-
export const ActionEase = ActionInterval.extend(/** @lends ActionEase# */ {
|
|
3
|
-
_inner: null,
|
|
4
|
-
/**
|
|
5
|
-
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
|
6
|
-
* creates the action of ActionEase.
|
|
7
|
-
* @param {ActionInterval} action
|
|
8
|
-
*/
|
|
9
|
-
ctor: function (action) {
|
|
10
|
-
ActionInterval.prototype.ctor.call(this);
|
|
11
|
-
action && this.initWithAction(action);
|
|
12
|
-
},
|
|
13
|
-
/**
|
|
14
|
-
* initializes the action
|
|
15
|
-
*
|
|
16
|
-
* @param {ActionInterval} action
|
|
17
|
-
* @return {Boolean}
|
|
18
|
-
*/
|
|
19
|
-
initWithAction: function (action) {
|
|
20
|
-
if (!action)
|
|
21
|
-
throw new Error("ActionEase.initWithAction(): action must be non nil");
|
|
22
|
-
if (this.initWithDuration(action.getDuration())) {
|
|
23
|
-
this._inner = action;
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* to copy object with deep copy.
|
|
30
|
-
* returns a clone of action.
|
|
31
|
-
*
|
|
32
|
-
* @returns {ActionEase}
|
|
33
|
-
*/
|
|
34
|
-
clone: function () {
|
|
35
|
-
var action = new ActionEase();
|
|
36
|
-
action.initWithAction(this._inner.clone());
|
|
37
|
-
return action;
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* called before the action start. It will also set the target.
|
|
41
|
-
*
|
|
42
|
-
* @param {Node} target
|
|
43
|
-
*/
|
|
44
|
-
startWithTarget: function (target) {
|
|
45
|
-
ActionInterval.prototype.startWithTarget.call(this, target);
|
|
46
|
-
this._inner.startWithTarget(this.target);
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* Stop the action.
|
|
50
|
-
*/
|
|
51
|
-
stop: function () {
|
|
52
|
-
this._inner.stop();
|
|
53
|
-
ActionInterval.prototype.stop.call(this);
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
57
|
-
*
|
|
58
|
-
* @param {Number} dt
|
|
59
|
-
*/
|
|
60
|
-
update: function (dt) {
|
|
61
|
-
this._inner.update(dt);
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* Create new action to original operation effect opposite. <br />
|
|
65
|
-
* For example: <br />
|
|
66
|
-
* - The action will be x coordinates of 0 move to 100. <br />
|
|
67
|
-
* - The reversed action will be x of 100 move to 0.
|
|
68
|
-
* - Will be rewritten
|
|
69
|
-
* @return {ActionEase}
|
|
70
|
-
*/
|
|
71
|
-
reverse: function () {
|
|
72
|
-
return new ActionEase(this._inner.reverse());
|
|
73
|
-
},
|
|
74
|
-
/**
|
|
75
|
-
* Get inner Action.
|
|
76
|
-
*
|
|
77
|
-
* @return {ActionInterval}
|
|
78
|
-
*/
|
|
79
|
-
getInnerAction: function () {
|
|
80
|
-
return this._inner;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
/**
|
|
84
|
-
* creates the action of ActionEase
|
|
85
|
-
*
|
|
86
|
-
* @param {ActionInterval} action
|
|
87
|
-
* @return {ActionEase}
|
|
88
|
-
* @example
|
|
89
|
-
* // example
|
|
90
|
-
* var moveEase = actionEase(action);
|
|
91
|
-
*/
|
|
92
|
-
export const actionEase = function (action) {
|
|
93
|
-
return new ActionEase(action);
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Base class for Easing actions with rate parameters
|
|
97
|
-
*
|
|
98
|
-
* @class
|
|
99
|
-
* @extends ActionEase
|
|
100
|
-
* @param {ActionInterval} action
|
|
101
|
-
* @param {Number} rate
|
|
102
|
-
*
|
|
103
|
-
* @deprecated since v3.0 please easeRateAction(action, 3.0);
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* //The old usage
|
|
107
|
-
* EaseRateAction.create(action, 3.0);
|
|
108
|
-
* //The new usage
|
|
109
|
-
* var moveEaseRateAction = easeRateAction(action, 3.0);
|
|
110
|
-
*/
|
|
111
|
-
export const EaseRateAction = ActionEase.extend(/** @lends EaseRateAction# */ {
|
|
112
|
-
_rate: 0,
|
|
113
|
-
/**
|
|
114
|
-
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
|
115
|
-
* Creates the action with the inner action and the rate parameter.
|
|
116
|
-
* @param {ActionInterval} action
|
|
117
|
-
* @param {Number} rate
|
|
118
|
-
*/
|
|
119
|
-
ctor: function (action, rate) {
|
|
120
|
-
ActionEase.prototype.ctor.call(this);
|
|
121
|
-
rate !== undefined && this.initWithAction(action, rate);
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* set rate value for the actions
|
|
125
|
-
* @param {Number} rate
|
|
126
|
-
*/
|
|
127
|
-
setRate: function (rate) {
|
|
128
|
-
this._rate = rate;
|
|
129
|
-
},
|
|
130
|
-
/** get rate value for the actions
|
|
131
|
-
* @return {Number}
|
|
132
|
-
*/
|
|
133
|
-
getRate: function () {
|
|
134
|
-
return this._rate;
|
|
135
|
-
},
|
|
136
|
-
/**
|
|
137
|
-
* Initializes the action with the inner action and the rate parameter
|
|
138
|
-
* @param {ActionInterval} action
|
|
139
|
-
* @param {Number} rate
|
|
140
|
-
* @return {Boolean}
|
|
141
|
-
*/
|
|
142
|
-
initWithAction: function (action, rate) {
|
|
143
|
-
if (ActionEase.prototype.initWithAction.call(this, action)) {
|
|
144
|
-
this._rate = rate;
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
return false;
|
|
148
|
-
},
|
|
149
|
-
/**
|
|
150
|
-
* to copy object with deep copy.
|
|
151
|
-
* returns a clone of action.
|
|
152
|
-
*
|
|
153
|
-
* @returns {EaseRateAction}
|
|
154
|
-
*/
|
|
155
|
-
clone: function () {
|
|
156
|
-
var action = new EaseRateAction();
|
|
157
|
-
action.initWithAction(this._inner.clone(), this._rate);
|
|
158
|
-
return action;
|
|
159
|
-
},
|
|
160
|
-
/**
|
|
161
|
-
* Create new action to original operation effect opposite. <br />
|
|
162
|
-
* For example: <br />
|
|
163
|
-
* - The action will be x coordinates of 0 move to 100. <br />
|
|
164
|
-
* - The reversed action will be x of 100 move to 0.
|
|
165
|
-
* - Will be rewritten
|
|
166
|
-
* @return {EaseRateAction}
|
|
167
|
-
*/
|
|
168
|
-
reverse: function () {
|
|
169
|
-
return new EaseRateAction(this._inner.reverse(), 1 / this._rate);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
/**
|
|
173
|
-
* Creates the action with the inner action and the rate parameter.
|
|
174
|
-
*
|
|
175
|
-
* @param {ActionInterval} action
|
|
176
|
-
* @param {Number} rate
|
|
177
|
-
* @return {EaseRateAction}
|
|
178
|
-
* @example
|
|
179
|
-
* // example
|
|
180
|
-
* var moveEaseRateAction = easeRateAction(action, 3.0);
|
|
181
|
-
*/
|
|
182
|
-
export const easeRateAction = function (action, rate) {
|
|
183
|
-
return new EaseRateAction(action, rate);
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* EaseIn action with a rate. From slow to fast.
|
|
187
|
-
*
|
|
188
|
-
* @class
|
|
189
|
-
* @extends EaseRateAction
|
|
190
|
-
*
|
|
191
|
-
* @deprecated since v3.0 please use action.easing(easeIn(3));
|
|
192
|
-
*
|
|
193
|
-
* @example
|
|
194
|
-
* //The old usage
|
|
195
|
-
* EaseIn.create(action, 3);
|
|
196
|
-
* //The new usage
|
|
197
|
-
* action.easing(easeIn(3.0));
|
|
198
|
-
*/
|
|
199
|
-
export const EaseIn = EaseRateAction.extend(/** @lends EaseIn# */ {
|
|
200
|
-
/**
|
|
201
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
202
|
-
*
|
|
203
|
-
* @param {Number} dt
|
|
204
|
-
*/
|
|
205
|
-
update: function (dt) {
|
|
206
|
-
this._inner.update(Math.pow(dt, this._rate));
|
|
207
|
-
},
|
|
208
|
-
/**
|
|
209
|
-
* Create a easeIn action. Opposite with the original motion trajectory.
|
|
210
|
-
* @return {EaseIn}
|
|
211
|
-
*/
|
|
212
|
-
reverse: function () {
|
|
213
|
-
return new EaseIn(this._inner.reverse(), 1 / this._rate);
|
|
214
|
-
},
|
|
215
|
-
/**
|
|
216
|
-
* to copy object with deep copy.
|
|
217
|
-
* returns a clone of action.
|
|
218
|
-
*
|
|
219
|
-
* @returns {EaseIn}
|
|
220
|
-
*/
|
|
221
|
-
clone: function () {
|
|
222
|
-
var action = new EaseIn();
|
|
223
|
-
action.initWithAction(this._inner.clone(), this._rate);
|
|
224
|
-
return action;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
/**
|
|
228
|
-
* Creates the action with the inner action and the rate parameter. <br />
|
|
229
|
-
* From slow to fast.
|
|
230
|
-
*
|
|
231
|
-
* @static
|
|
232
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeIn(3))
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* //The old usage
|
|
236
|
-
* EaseIn.create(action, 3);
|
|
237
|
-
* //The new usage
|
|
238
|
-
* action.easing(easeIn(3.0));
|
|
239
|
-
*
|
|
240
|
-
* @param {ActionInterval} action
|
|
241
|
-
* @param {Number} rate
|
|
242
|
-
* @return {EaseIn}
|
|
243
|
-
*/
|
|
244
|
-
EaseIn.create = function (action, rate) {
|
|
245
|
-
return new EaseIn(action, rate);
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* Creates the action easing object with the rate parameter. <br />
|
|
249
|
-
* From slow to fast.
|
|
250
|
-
*
|
|
251
|
-
* @function
|
|
252
|
-
* @param {Number} rate
|
|
253
|
-
* @return {Object}
|
|
254
|
-
* @example
|
|
255
|
-
* // example
|
|
256
|
-
* action.easing(easeIn(3.0));
|
|
257
|
-
*/
|
|
258
|
-
export const easeIn = function (rate) {
|
|
259
|
-
return {
|
|
260
|
-
_rate: rate,
|
|
261
|
-
easing: function (dt) {
|
|
262
|
-
return Math.pow(dt, this._rate);
|
|
263
|
-
},
|
|
264
|
-
reverse: function () {
|
|
265
|
-
return easeIn(1 / this._rate);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
};
|
|
269
|
-
/**
|
|
270
|
-
* EaseOut action with a rate. From fast to slow.
|
|
271
|
-
*
|
|
272
|
-
* @class
|
|
273
|
-
* @extends EaseRateAction
|
|
274
|
-
*
|
|
275
|
-
* @deprecated since v3.0 please use action.easing(easeOut(3))
|
|
276
|
-
*
|
|
277
|
-
* @example
|
|
278
|
-
* //The old usage
|
|
279
|
-
* EaseOut.create(action, 3);
|
|
280
|
-
* //The new usage
|
|
281
|
-
* action.easing(easeOut(3.0));
|
|
282
|
-
*/
|
|
283
|
-
export const EaseOut = EaseRateAction.extend(/** @lends EaseOut# */ {
|
|
284
|
-
/**
|
|
285
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
286
|
-
*
|
|
287
|
-
* @param {Number} dt
|
|
288
|
-
*/
|
|
289
|
-
update: function (dt) {
|
|
290
|
-
this._inner.update(Math.pow(dt, 1 / this._rate));
|
|
291
|
-
},
|
|
292
|
-
/**
|
|
293
|
-
* Create a easeIn action. Opposite with the original motion trajectory.
|
|
294
|
-
* @return {EaseOut}
|
|
295
|
-
*/
|
|
296
|
-
reverse: function () {
|
|
297
|
-
return new EaseOut(this._inner.reverse(), 1 / this._rate);
|
|
298
|
-
},
|
|
299
|
-
/**
|
|
300
|
-
* to copy object with deep copy.
|
|
301
|
-
* returns a clone of action.
|
|
302
|
-
*
|
|
303
|
-
* @returns {EaseOut}
|
|
304
|
-
*/
|
|
305
|
-
clone: function () {
|
|
306
|
-
var action = new EaseOut();
|
|
307
|
-
action.initWithAction(this._inner.clone(), this._rate);
|
|
308
|
-
return action;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
/**
|
|
312
|
-
* Creates the action easing object with the rate parameter. <br />
|
|
313
|
-
* From fast to slow.
|
|
314
|
-
*
|
|
315
|
-
* @function
|
|
316
|
-
* @param {Number} rate
|
|
317
|
-
* @return {Object}
|
|
318
|
-
* @example
|
|
319
|
-
* // example
|
|
320
|
-
* action.easing(easeOut(3.0));
|
|
321
|
-
*/
|
|
322
|
-
export const easeOut = function (rate) {
|
|
323
|
-
return {
|
|
324
|
-
_rate: rate,
|
|
325
|
-
easing: function (dt) {
|
|
326
|
-
return Math.pow(dt, 1 / this._rate);
|
|
327
|
-
},
|
|
328
|
-
reverse: function () {
|
|
329
|
-
return easeOut(1 / this._rate);
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
};
|
|
333
|
-
/**
|
|
334
|
-
* EaseInOut action with a rate. <br />
|
|
335
|
-
* Slow to fast then to slow.
|
|
336
|
-
* @class
|
|
337
|
-
* @extends EaseRateAction
|
|
338
|
-
*
|
|
339
|
-
* @deprecated since v3.0 please use action.easing(easeInOut(3.0))
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* //The old usage
|
|
343
|
-
* EaseInOut.create(action, 3);
|
|
344
|
-
* //The new usage
|
|
345
|
-
* action.easing(easeInOut(3.0));
|
|
346
|
-
*/
|
|
347
|
-
export const EaseInOut = EaseRateAction.extend(/** @lends EaseInOut# */ {
|
|
348
|
-
/**
|
|
349
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
350
|
-
*
|
|
351
|
-
* @param {Number} dt
|
|
352
|
-
*/
|
|
353
|
-
update: function (dt) {
|
|
354
|
-
dt *= 2;
|
|
355
|
-
if (dt < 1)
|
|
356
|
-
this._inner.update(0.5 * Math.pow(dt, this._rate));
|
|
357
|
-
else
|
|
358
|
-
this._inner.update(1.0 - 0.5 * Math.pow(2 - dt, this._rate));
|
|
359
|
-
},
|
|
360
|
-
/**
|
|
361
|
-
* to copy object with deep copy.
|
|
362
|
-
* returns a clone of action.
|
|
363
|
-
*
|
|
364
|
-
* @returns {EaseInOut}
|
|
365
|
-
*/
|
|
366
|
-
clone: function () {
|
|
367
|
-
var action = new EaseInOut();
|
|
368
|
-
action.initWithAction(this._inner.clone(), this._rate);
|
|
369
|
-
return action;
|
|
370
|
-
},
|
|
371
|
-
/**
|
|
372
|
-
* Create a EaseInOut action. Opposite with the original motion trajectory.
|
|
373
|
-
* @return {EaseInOut}
|
|
374
|
-
*/
|
|
375
|
-
reverse: function () {
|
|
376
|
-
return new EaseInOut(this._inner.reverse(), this._rate);
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
/**
|
|
380
|
-
* Creates the action with the inner action and the rate parameter.
|
|
381
|
-
* Slow to fast then to slow.
|
|
382
|
-
* @static
|
|
383
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeInOut(3.0))
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* //The old usage
|
|
387
|
-
* EaseInOut.create(action, 3);
|
|
388
|
-
* //The new usage
|
|
389
|
-
* action.easing(easeInOut(3.0));
|
|
390
|
-
*
|
|
391
|
-
* @param {ActionInterval} action
|
|
392
|
-
* @param {Number} rate
|
|
393
|
-
* @return {EaseInOut}
|
|
394
|
-
*/
|
|
395
|
-
EaseInOut.create = function (action, rate) {
|
|
396
|
-
return new EaseInOut(action, rate);
|
|
397
|
-
};
|
|
398
|
-
/**
|
|
399
|
-
* Creates the action easing object with the rate parameter. <br />
|
|
400
|
-
* Slow to fast then to slow.
|
|
401
|
-
* @function
|
|
402
|
-
* @param {Number} rate
|
|
403
|
-
* @return {Object}
|
|
404
|
-
*
|
|
405
|
-
* @example
|
|
406
|
-
* //The new usage
|
|
407
|
-
* action.easing(easeInOut(3.0));
|
|
408
|
-
*/
|
|
409
|
-
export const easeInOut = function (rate) {
|
|
410
|
-
return {
|
|
411
|
-
_rate: rate,
|
|
412
|
-
easing: function (dt) {
|
|
413
|
-
dt *= 2;
|
|
414
|
-
if (dt < 1)
|
|
415
|
-
return 0.5 * Math.pow(dt, this._rate);
|
|
416
|
-
else
|
|
417
|
-
return 1.0 - 0.5 * Math.pow(2 - dt, this._rate);
|
|
418
|
-
},
|
|
419
|
-
reverse: function () {
|
|
420
|
-
return easeInOut(this._rate);
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
};
|
|
424
|
-
/**
|
|
425
|
-
* Ease Exponential In. Slow to Fast. <br />
|
|
426
|
-
* Reference easeInExpo: <br />
|
|
427
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
428
|
-
* @class
|
|
429
|
-
* @extends ActionEase
|
|
430
|
-
*
|
|
431
|
-
* @deprecated since v3.0 please action.easing(easeExponentialIn())
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* //The old usage
|
|
435
|
-
* EaseExponentialIn.create(action);
|
|
436
|
-
* //The new usage
|
|
437
|
-
* action.easing(easeExponentialIn());
|
|
438
|
-
*/
|
|
439
|
-
export const EaseExponentialIn = ActionEase.extend(/** @lends EaseExponentialIn# */ {
|
|
440
|
-
/**
|
|
441
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
442
|
-
*
|
|
443
|
-
* @param {Number} dt
|
|
444
|
-
*/
|
|
445
|
-
update: function (dt) {
|
|
446
|
-
this._inner.update(dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1)));
|
|
447
|
-
},
|
|
448
|
-
/**
|
|
449
|
-
* Create a EaseExponentialOut action. Opposite with the original motion trajectory.
|
|
450
|
-
* @return {EaseExponentialOut}
|
|
451
|
-
*/
|
|
452
|
-
reverse: function () {
|
|
453
|
-
return new EaseExponentialOut(this._inner.reverse());
|
|
454
|
-
},
|
|
455
|
-
/**
|
|
456
|
-
* to copy object with deep copy.
|
|
457
|
-
* returns a clone of action.
|
|
458
|
-
*
|
|
459
|
-
* @returns {EaseExponentialIn}
|
|
460
|
-
*/
|
|
461
|
-
clone: function () {
|
|
462
|
-
var action = new EaseExponentialIn();
|
|
463
|
-
action.initWithAction(this._inner.clone());
|
|
464
|
-
return action;
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
export const _easeExponentialInObj = {
|
|
468
|
-
easing: function (dt) {
|
|
469
|
-
return dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1));
|
|
470
|
-
},
|
|
471
|
-
reverse: function () {
|
|
472
|
-
return _easeExponentialOutObj;
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
/**
|
|
476
|
-
* Creates the action easing object with the rate parameter. <br />
|
|
477
|
-
* Reference easeInExpo: <br />
|
|
478
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
479
|
-
* @function
|
|
480
|
-
* @return {Object}
|
|
481
|
-
* @example
|
|
482
|
-
* // example
|
|
483
|
-
* action.easing(easeExponentialIn());
|
|
484
|
-
*/
|
|
485
|
-
export const easeExponentialIn = function () {
|
|
486
|
-
return _easeExponentialInObj;
|
|
487
|
-
};
|
|
488
|
-
/**
|
|
489
|
-
* Ease Exponential Out. <br />
|
|
490
|
-
* Reference easeOutExpo: <br />
|
|
491
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
492
|
-
* @class
|
|
493
|
-
* @extends ActionEase
|
|
494
|
-
*
|
|
495
|
-
* @deprecated since v3.0 please use action.easing(easeExponentialOut())
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* //The old usage
|
|
499
|
-
* EaseExponentialOut.create(action);
|
|
500
|
-
* //The new usage
|
|
501
|
-
* action.easing(easeExponentialOut());
|
|
502
|
-
*/
|
|
503
|
-
export const EaseExponentialOut = ActionEase.extend(/** @lends EaseExponentialOut# */ {
|
|
504
|
-
/**
|
|
505
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
506
|
-
*
|
|
507
|
-
* @param {Number} dt
|
|
508
|
-
*/
|
|
509
|
-
update: function (dt) {
|
|
510
|
-
this._inner.update(dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1));
|
|
511
|
-
},
|
|
512
|
-
/**
|
|
513
|
-
* Create a EaseExponentialIn action. Opposite with the original motion trajectory.
|
|
514
|
-
* @return {EaseExponentialIn}
|
|
515
|
-
*/
|
|
516
|
-
reverse: function () {
|
|
517
|
-
return new EaseExponentialIn(this._inner.reverse());
|
|
518
|
-
},
|
|
519
|
-
/**
|
|
520
|
-
* to copy object with deep copy.
|
|
521
|
-
* returns a clone of action.
|
|
522
|
-
*
|
|
523
|
-
* @returns {EaseExponentialOut}
|
|
524
|
-
*/
|
|
525
|
-
clone: function () {
|
|
526
|
-
var action = new EaseExponentialOut();
|
|
527
|
-
action.initWithAction(this._inner.clone());
|
|
528
|
-
return action;
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
export const _easeExponentialOutObj = {
|
|
532
|
-
easing: function (dt) {
|
|
533
|
-
return dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1);
|
|
534
|
-
},
|
|
535
|
-
reverse: function () {
|
|
536
|
-
return _easeExponentialInObj;
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
/**
|
|
540
|
-
* creates the action easing object. <br />
|
|
541
|
-
* Reference easeOutExpo: <br />
|
|
542
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
543
|
-
*
|
|
544
|
-
* @return {Object}
|
|
545
|
-
* @example
|
|
546
|
-
* // example
|
|
547
|
-
* action.easing(easeExponentialOut());
|
|
548
|
-
*/
|
|
549
|
-
export const easeExponentialOut = function () {
|
|
550
|
-
return _easeExponentialOutObj;
|
|
551
|
-
};
|
|
552
|
-
/**
|
|
553
|
-
* Ease Exponential InOut. <br />
|
|
554
|
-
* Reference easeInOutExpo: <br />
|
|
555
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
556
|
-
*
|
|
557
|
-
* @class
|
|
558
|
-
* @extends ActionEase
|
|
559
|
-
*
|
|
560
|
-
* @deprecated since v3.0 please use action.easing(easeExponentialInOut)
|
|
561
|
-
*
|
|
562
|
-
* @example
|
|
563
|
-
* //The old usage
|
|
564
|
-
* EaseExponentialInOut.create(action);
|
|
565
|
-
* //The new usage
|
|
566
|
-
* action.easing(easeExponentialInOut());
|
|
567
|
-
*/
|
|
568
|
-
export const EaseExponentialInOut = ActionEase.extend(/** @lends EaseExponentialInOut# */ {
|
|
569
|
-
/**
|
|
570
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
571
|
-
*
|
|
572
|
-
* @param {Number} dt
|
|
573
|
-
*/
|
|
574
|
-
update: function (dt) {
|
|
575
|
-
if (dt !== 1 && dt !== 0) {
|
|
576
|
-
dt *= 2;
|
|
577
|
-
if (dt < 1)
|
|
578
|
-
dt = 0.5 * Math.pow(2, 10 * (dt - 1));
|
|
579
|
-
else
|
|
580
|
-
dt = 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
|
|
581
|
-
}
|
|
582
|
-
this._inner.update(dt);
|
|
583
|
-
},
|
|
584
|
-
/**
|
|
585
|
-
* Create a EaseExponentialInOut action. Opposite with the original motion trajectory.
|
|
586
|
-
* @return {EaseExponentialInOut}
|
|
587
|
-
*/
|
|
588
|
-
reverse: function () {
|
|
589
|
-
return new EaseExponentialInOut(this._inner.reverse());
|
|
590
|
-
},
|
|
591
|
-
/**
|
|
592
|
-
* to copy object with deep copy.
|
|
593
|
-
* returns a clone of action.
|
|
594
|
-
*
|
|
595
|
-
* @returns {EaseExponentialInOut}
|
|
596
|
-
*/
|
|
597
|
-
clone: function () {
|
|
598
|
-
var action = new EaseExponentialInOut();
|
|
599
|
-
action.initWithAction(this._inner.clone());
|
|
600
|
-
return action;
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
export const _easeExponentialInOutObj = {
|
|
604
|
-
easing: function (dt) {
|
|
605
|
-
if (dt !== 1 && dt !== 0) {
|
|
606
|
-
dt *= 2;
|
|
607
|
-
if (dt < 1)
|
|
608
|
-
return 0.5 * Math.pow(2, 10 * (dt - 1));
|
|
609
|
-
else
|
|
610
|
-
return 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
|
|
611
|
-
}
|
|
612
|
-
return dt;
|
|
613
|
-
},
|
|
614
|
-
reverse: function () {
|
|
615
|
-
return _easeExponentialInOutObj;
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
/**
|
|
619
|
-
* creates an EaseExponentialInOut action easing object. <br />
|
|
620
|
-
* Reference easeInOutExpo: <br />
|
|
621
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
622
|
-
* @function
|
|
623
|
-
* @return {Object}
|
|
624
|
-
* @example
|
|
625
|
-
* // example
|
|
626
|
-
* action.easing(easeExponentialInOut());
|
|
627
|
-
*/
|
|
628
|
-
export const easeExponentialInOut = function () {
|
|
629
|
-
return _easeExponentialInOutObj;
|
|
630
|
-
};
|
|
631
|
-
/**
|
|
632
|
-
* Ease Sine In. <br />
|
|
633
|
-
* Reference easeInSine: <br />
|
|
634
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
635
|
-
* @class
|
|
636
|
-
* @extends ActionEase
|
|
637
|
-
*
|
|
638
|
-
* @deprecated since v3.0 please use action.easing(easeSineIn())
|
|
639
|
-
*
|
|
640
|
-
* @example
|
|
641
|
-
* //The old usage
|
|
642
|
-
* EaseSineIn.create(action);
|
|
643
|
-
* //The new usage
|
|
644
|
-
* action.easing(easeSineIn());
|
|
645
|
-
*/
|
|
646
|
-
export const EaseSineIn = ActionEase.extend(/** @lends EaseSineIn# */ {
|
|
647
|
-
/**
|
|
648
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
649
|
-
*
|
|
650
|
-
* @param {Number} dt
|
|
651
|
-
*/
|
|
652
|
-
update: function (dt) {
|
|
653
|
-
dt = dt === 0 || dt === 1 ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
|
|
654
|
-
this._inner.update(dt);
|
|
655
|
-
},
|
|
656
|
-
/**
|
|
657
|
-
* Create a EaseSineOut action. Opposite with the original motion trajectory.
|
|
658
|
-
* @return {EaseSineOut}
|
|
659
|
-
*/
|
|
660
|
-
reverse: function () {
|
|
661
|
-
return new EaseSineOut(this._inner.reverse());
|
|
662
|
-
},
|
|
663
|
-
/**
|
|
664
|
-
* to copy object with deep copy.
|
|
665
|
-
* returns a clone of action.
|
|
666
|
-
*
|
|
667
|
-
* @returns {EaseSineIn}
|
|
668
|
-
*/
|
|
669
|
-
clone: function () {
|
|
670
|
-
var action = new EaseSineIn();
|
|
671
|
-
action.initWithAction(this._inner.clone());
|
|
672
|
-
return action;
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
export const _easeSineInObj = {
|
|
676
|
-
easing: function (dt) {
|
|
677
|
-
return (dt === 0 || dt === 1) ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
|
|
678
|
-
},
|
|
679
|
-
reverse: function () {
|
|
680
|
-
return _easeSineOutObj;
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
/**
|
|
684
|
-
* creates an EaseSineIn action. <br />
|
|
685
|
-
* Reference easeInSine: <br />
|
|
686
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
687
|
-
* @function
|
|
688
|
-
* @return {Object}
|
|
689
|
-
* @example
|
|
690
|
-
* // example
|
|
691
|
-
* action.easing(easeSineIn());
|
|
692
|
-
*/
|
|
693
|
-
export const easeSineIn = function () {
|
|
694
|
-
return _easeSineInObj;
|
|
695
|
-
};
|
|
696
|
-
/**
|
|
697
|
-
* Ease Sine Out. <br />
|
|
698
|
-
* Reference easeOutSine: <br />
|
|
699
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
700
|
-
* @class
|
|
701
|
-
* @extends ActionEase
|
|
702
|
-
*
|
|
703
|
-
* @deprecated since v3.0 please use action.easing(easeSineOut())
|
|
704
|
-
*
|
|
705
|
-
* @example
|
|
706
|
-
* //The old usage
|
|
707
|
-
* EaseSineOut.create(action);
|
|
708
|
-
* //The new usage
|
|
709
|
-
* action.easing(easeSineOut());
|
|
710
|
-
*/
|
|
711
|
-
export const EaseSineOut = ActionEase.extend(/** @lends EaseSineOut# */ {
|
|
712
|
-
/**
|
|
713
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
714
|
-
*
|
|
715
|
-
* @param {Number} dt
|
|
716
|
-
*/
|
|
717
|
-
update: function (dt) {
|
|
718
|
-
dt = dt === 0 || dt === 1 ? dt : Math.sin(dt * Math.PI / 2);
|
|
719
|
-
this._inner.update(dt);
|
|
720
|
-
},
|
|
721
|
-
/**
|
|
722
|
-
* Create a EaseSineIn action. Opposite with the original motion trajectory.
|
|
723
|
-
* @return {EaseSineIn}
|
|
724
|
-
*/
|
|
725
|
-
reverse: function () {
|
|
726
|
-
return new EaseSineIn(this._inner.reverse());
|
|
727
|
-
},
|
|
728
|
-
/**
|
|
729
|
-
* to copy object with deep copy.
|
|
730
|
-
* returns a clone of action.
|
|
731
|
-
*
|
|
732
|
-
* @returns {EaseSineOut}
|
|
733
|
-
*/
|
|
734
|
-
clone: function () {
|
|
735
|
-
var action = new EaseSineOut();
|
|
736
|
-
action.initWithAction(this._inner.clone());
|
|
737
|
-
return action;
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
export const _easeSineOutObj = {
|
|
741
|
-
easing: function (dt) {
|
|
742
|
-
return (dt === 0 || dt === 1) ? dt : Math.sin(dt * Math.PI / 2);
|
|
743
|
-
},
|
|
744
|
-
reverse: function () {
|
|
745
|
-
return _easeSineInObj;
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
/**
|
|
749
|
-
* Creates an EaseSineOut action easing object. <br />
|
|
750
|
-
* Reference easeOutSine: <br />
|
|
751
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
752
|
-
* @function
|
|
753
|
-
* @return {Object}
|
|
754
|
-
* @example
|
|
755
|
-
* // example
|
|
756
|
-
* action.easing(easeSineOut());
|
|
757
|
-
*/
|
|
758
|
-
export const easeSineOut = function () {
|
|
759
|
-
return _easeSineOutObj;
|
|
760
|
-
};
|
|
761
|
-
/**
|
|
762
|
-
* Ease Sine InOut. <br />
|
|
763
|
-
* Reference easeInOutSine: <br />
|
|
764
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
765
|
-
* @class
|
|
766
|
-
* @extends ActionEase
|
|
767
|
-
*
|
|
768
|
-
* @deprecated since v3.0 please use action.easing(easeSineInOut())
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* //The old usage
|
|
772
|
-
* EaseSineInOut.create(action);
|
|
773
|
-
* //The new usage
|
|
774
|
-
* action.easing(easeSineInOut());
|
|
775
|
-
*/
|
|
776
|
-
export const EaseSineInOut = ActionEase.extend(/** @lends EaseSineInOut# */ {
|
|
777
|
-
/**
|
|
778
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
779
|
-
*
|
|
780
|
-
* @param {Number} dt
|
|
781
|
-
*/
|
|
782
|
-
update: function (dt) {
|
|
783
|
-
dt = dt === 0 || dt === 1 ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
|
|
784
|
-
this._inner.update(dt);
|
|
785
|
-
},
|
|
786
|
-
/**
|
|
787
|
-
* to copy object with deep copy.
|
|
788
|
-
* returns a clone of action.
|
|
789
|
-
*
|
|
790
|
-
* @returns {EaseSineInOut}
|
|
791
|
-
*/
|
|
792
|
-
clone: function () {
|
|
793
|
-
var action = new EaseSineInOut();
|
|
794
|
-
action.initWithAction(this._inner.clone());
|
|
795
|
-
return action;
|
|
796
|
-
},
|
|
797
|
-
/**
|
|
798
|
-
* Create a EaseSineInOut action. Opposite with the original motion trajectory.
|
|
799
|
-
* @return {EaseSineInOut}
|
|
800
|
-
*/
|
|
801
|
-
reverse: function () {
|
|
802
|
-
return new EaseSineInOut(this._inner.reverse());
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
export const _easeSineInOutObj = {
|
|
806
|
-
easing: function (dt) {
|
|
807
|
-
return (dt === 0 || dt === 1) ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
|
|
808
|
-
},
|
|
809
|
-
reverse: function () {
|
|
810
|
-
return _easeSineInOutObj;
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
/**
|
|
814
|
-
* creates the action easing object. <br />
|
|
815
|
-
* Reference easeInOutSine: <br />
|
|
816
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
817
|
-
* @return {Object}
|
|
818
|
-
* @example
|
|
819
|
-
* // example
|
|
820
|
-
* action.easing(easeSineInOut());
|
|
821
|
-
*/
|
|
822
|
-
export const easeSineInOut = function () {
|
|
823
|
-
return _easeSineInOutObj;
|
|
824
|
-
};
|
|
825
|
-
/**
|
|
826
|
-
* Ease Elastic abstract class.
|
|
827
|
-
* @class
|
|
828
|
-
* @extends ActionEase
|
|
829
|
-
* @param {ActionInterval} action
|
|
830
|
-
* @param {Number} [period=0.3]
|
|
831
|
-
*
|
|
832
|
-
* @deprecated since v3.0 Does not recommend the use of the base object.
|
|
833
|
-
*/
|
|
834
|
-
export const EaseElastic = ActionEase.extend(/** @lends EaseElastic# */ {
|
|
835
|
-
_period: 0.3,
|
|
836
|
-
/**
|
|
837
|
-
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
|
838
|
-
* Creates the action with the inner action and the period in radians (default is 0.3).
|
|
839
|
-
* @param {ActionInterval} action
|
|
840
|
-
* @param {Number} [period=0.3]
|
|
841
|
-
*/
|
|
842
|
-
ctor: function (action, period) {
|
|
843
|
-
ActionEase.prototype.ctor.call(this);
|
|
844
|
-
action && this.initWithAction(action, period);
|
|
845
|
-
},
|
|
846
|
-
/**
|
|
847
|
-
* get period of the wave in radians. default is 0.3
|
|
848
|
-
* @return {Number}
|
|
849
|
-
*/
|
|
850
|
-
getPeriod: function () {
|
|
851
|
-
return this._period;
|
|
852
|
-
},
|
|
853
|
-
/**
|
|
854
|
-
* set period of the wave in radians.
|
|
855
|
-
* @param {Number} period
|
|
856
|
-
*/
|
|
857
|
-
setPeriod: function (period) {
|
|
858
|
-
this._period = period;
|
|
859
|
-
},
|
|
860
|
-
/**
|
|
861
|
-
* Initializes the action with the inner action and the period in radians (default is 0.3)
|
|
862
|
-
* @param {ActionInterval} action
|
|
863
|
-
* @param {Number} [period=0.3]
|
|
864
|
-
* @return {Boolean}
|
|
865
|
-
*/
|
|
866
|
-
initWithAction: function (action, period) {
|
|
867
|
-
ActionEase.prototype.initWithAction.call(this, action);
|
|
868
|
-
this._period = (period == null) ? 0.3 : period;
|
|
869
|
-
return true;
|
|
870
|
-
},
|
|
871
|
-
/**
|
|
872
|
-
* Create a action. Opposite with the original motion trajectory. <br />
|
|
873
|
-
* Will be overwrite.
|
|
874
|
-
* @return {?Action}
|
|
875
|
-
*/
|
|
876
|
-
reverse: function () {
|
|
877
|
-
log("EaseElastic.reverse(): it should be overridden in subclass.");
|
|
878
|
-
return null;
|
|
879
|
-
},
|
|
880
|
-
/**
|
|
881
|
-
* to copy object with deep copy.
|
|
882
|
-
* returns a clone of action.
|
|
883
|
-
*
|
|
884
|
-
* @returns {EaseElastic}
|
|
885
|
-
*/
|
|
886
|
-
clone: function () {
|
|
887
|
-
var action = new EaseElastic();
|
|
888
|
-
action.initWithAction(this._inner.clone(), this._period);
|
|
889
|
-
return action;
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
/**
|
|
893
|
-
* Ease Elastic In action. <br />
|
|
894
|
-
* Reference easeInElastic: <br />
|
|
895
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
896
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
897
|
-
* @class
|
|
898
|
-
* @extends EaseElastic
|
|
899
|
-
*
|
|
900
|
-
* @deprecated since v3.0 please use action.easing(easeElasticIn())
|
|
901
|
-
*
|
|
902
|
-
* @example
|
|
903
|
-
* //The old usage
|
|
904
|
-
* EaseElasticIn.create(action, period);
|
|
905
|
-
* //The new usage
|
|
906
|
-
* action.easing(easeElasticIn(period));
|
|
907
|
-
*/
|
|
908
|
-
export const EaseElasticIn = EaseElastic.extend(/** @lends EaseElasticIn# */ {
|
|
909
|
-
/**
|
|
910
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
911
|
-
*
|
|
912
|
-
* @param {Number} dt
|
|
913
|
-
*/
|
|
914
|
-
update: function (dt) {
|
|
915
|
-
var newT = 0;
|
|
916
|
-
if (dt === 0 || dt === 1) {
|
|
917
|
-
newT = dt;
|
|
918
|
-
}
|
|
919
|
-
else {
|
|
920
|
-
var s = this._period / 4;
|
|
921
|
-
dt = dt - 1;
|
|
922
|
-
newT = -Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / this._period);
|
|
923
|
-
}
|
|
924
|
-
this._inner.update(newT);
|
|
925
|
-
},
|
|
926
|
-
/**
|
|
927
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
928
|
-
* @return {EaseElasticOut}
|
|
929
|
-
*/
|
|
930
|
-
reverse: function () {
|
|
931
|
-
return new EaseElasticOut(this._inner.reverse(), this._period);
|
|
932
|
-
},
|
|
933
|
-
/**
|
|
934
|
-
* to copy object with deep copy.
|
|
935
|
-
* returns a clone of action.
|
|
936
|
-
*
|
|
937
|
-
* @returns {EaseElasticIn}
|
|
938
|
-
*/
|
|
939
|
-
clone: function () {
|
|
940
|
-
var action = new EaseElasticIn();
|
|
941
|
-
action.initWithAction(this._inner.clone(), this._period);
|
|
942
|
-
return action;
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
//default ease elastic in object (period = 0.3)
|
|
946
|
-
export const _easeElasticInObj = {
|
|
947
|
-
easing: function (dt) {
|
|
948
|
-
if (dt === 0 || dt === 1)
|
|
949
|
-
return dt;
|
|
950
|
-
dt = dt - 1;
|
|
951
|
-
return -Math.pow(2, 10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3);
|
|
952
|
-
},
|
|
953
|
-
reverse: function () {
|
|
954
|
-
return _easeElasticOutObj;
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
/**
|
|
958
|
-
* Creates the action easing obejct with the period in radians (default is 0.3). <br />
|
|
959
|
-
* Reference easeInElastic: <br />
|
|
960
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
961
|
-
* @function
|
|
962
|
-
* @param {Number} [period=0.3]
|
|
963
|
-
* @return {Object}
|
|
964
|
-
* @example
|
|
965
|
-
* // example
|
|
966
|
-
* action.easing(easeElasticIn(3.0));
|
|
967
|
-
*/
|
|
968
|
-
export const easeElasticIn = function (period) {
|
|
969
|
-
if (period && period !== 0.3) {
|
|
970
|
-
return {
|
|
971
|
-
_period: period,
|
|
972
|
-
easing: function (dt) {
|
|
973
|
-
if (dt === 0 || dt === 1)
|
|
974
|
-
return dt;
|
|
975
|
-
dt = dt - 1;
|
|
976
|
-
return -Math.pow(2, 10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period);
|
|
977
|
-
},
|
|
978
|
-
reverse: function () {
|
|
979
|
-
return easeElasticOut(this._period);
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
return _easeElasticInObj;
|
|
984
|
-
};
|
|
985
|
-
/**
|
|
986
|
-
* Ease Elastic Out action. <br />
|
|
987
|
-
* Reference easeOutElastic: <br />
|
|
988
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
989
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
990
|
-
* @class
|
|
991
|
-
* @extends EaseElastic
|
|
992
|
-
*
|
|
993
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeElasticOut(period))
|
|
994
|
-
*
|
|
995
|
-
* @example
|
|
996
|
-
* //The old usage
|
|
997
|
-
* EaseElasticOut.create(action, period);
|
|
998
|
-
* //The new usage
|
|
999
|
-
* action.easing(easeElasticOut(period));
|
|
1000
|
-
*/
|
|
1001
|
-
export const EaseElasticOut = EaseElastic.extend(/** @lends EaseElasticOut# */ {
|
|
1002
|
-
/**
|
|
1003
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1004
|
-
*
|
|
1005
|
-
* @param {Number} dt
|
|
1006
|
-
*/
|
|
1007
|
-
update: function (dt) {
|
|
1008
|
-
var newT = 0;
|
|
1009
|
-
if (dt === 0 || dt === 1) {
|
|
1010
|
-
newT = dt;
|
|
1011
|
-
}
|
|
1012
|
-
else {
|
|
1013
|
-
var s = this._period / 4;
|
|
1014
|
-
newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / this._period) + 1;
|
|
1015
|
-
}
|
|
1016
|
-
this._inner.update(newT);
|
|
1017
|
-
},
|
|
1018
|
-
/**
|
|
1019
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1020
|
-
* @return {EaseElasticIn}
|
|
1021
|
-
*/
|
|
1022
|
-
reverse: function () {
|
|
1023
|
-
return new EaseElasticIn(this._inner.reverse(), this._period);
|
|
1024
|
-
},
|
|
1025
|
-
/**
|
|
1026
|
-
* to copy object with deep copy.
|
|
1027
|
-
* returns a clone of action.
|
|
1028
|
-
*
|
|
1029
|
-
* @returns {EaseElasticOut}
|
|
1030
|
-
*/
|
|
1031
|
-
clone: function () {
|
|
1032
|
-
var action = new EaseElasticOut();
|
|
1033
|
-
action.initWithAction(this._inner.clone(), this._period);
|
|
1034
|
-
return action;
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
//default ease elastic out object (period = 0.3)
|
|
1038
|
-
export const _easeElasticOutObj = {
|
|
1039
|
-
easing: function (dt) {
|
|
1040
|
-
return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3) + 1;
|
|
1041
|
-
},
|
|
1042
|
-
reverse: function () {
|
|
1043
|
-
return _easeElasticInObj;
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
/**
|
|
1047
|
-
* Creates the action easing object with the period in radians (default is 0.3). <br />
|
|
1048
|
-
* Reference easeOutElastic: <br />
|
|
1049
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1050
|
-
* @function
|
|
1051
|
-
* @param {Number} [period=0.3]
|
|
1052
|
-
* @return {Object}
|
|
1053
|
-
* @example
|
|
1054
|
-
* // example
|
|
1055
|
-
* action.easing(easeElasticOut(3.0));
|
|
1056
|
-
*/
|
|
1057
|
-
export const easeElasticOut = function (period) {
|
|
1058
|
-
if (period && period !== 0.3) {
|
|
1059
|
-
return {
|
|
1060
|
-
_period: period,
|
|
1061
|
-
easing: function (dt) {
|
|
1062
|
-
return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period) + 1;
|
|
1063
|
-
},
|
|
1064
|
-
reverse: function () {
|
|
1065
|
-
return easeElasticIn(this._period);
|
|
1066
|
-
}
|
|
1067
|
-
};
|
|
1068
|
-
}
|
|
1069
|
-
return _easeElasticOutObj;
|
|
1070
|
-
};
|
|
1071
|
-
/**
|
|
1072
|
-
* Ease Elastic InOut action. <br />
|
|
1073
|
-
* Reference easeInOutElastic: <br />
|
|
1074
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1075
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1076
|
-
* @class
|
|
1077
|
-
* @extends EaseElastic
|
|
1078
|
-
*
|
|
1079
|
-
* @deprecated since v3.0 please use action.easing(easeElasticInOut())
|
|
1080
|
-
*
|
|
1081
|
-
* @example
|
|
1082
|
-
* //The old usage
|
|
1083
|
-
* EaseElasticInOut.create(action, period);
|
|
1084
|
-
* //The new usage
|
|
1085
|
-
* action.easing(easeElasticInOut(period));
|
|
1086
|
-
*/
|
|
1087
|
-
export const EaseElasticInOut = EaseElastic.extend(/** @lends EaseElasticInOut# */ {
|
|
1088
|
-
/**
|
|
1089
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1090
|
-
*
|
|
1091
|
-
* @param {Number} dt
|
|
1092
|
-
*/
|
|
1093
|
-
update: function (dt) {
|
|
1094
|
-
var newT = 0;
|
|
1095
|
-
var locPeriod = this._period;
|
|
1096
|
-
if (dt === 0 || dt === 1) {
|
|
1097
|
-
newT = dt;
|
|
1098
|
-
}
|
|
1099
|
-
else {
|
|
1100
|
-
dt = dt * 2;
|
|
1101
|
-
if (!locPeriod)
|
|
1102
|
-
locPeriod = this._period = 0.3 * 1.5;
|
|
1103
|
-
var s = locPeriod / 4;
|
|
1104
|
-
dt = dt - 1;
|
|
1105
|
-
if (dt < 0)
|
|
1106
|
-
newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
|
|
1107
|
-
else
|
|
1108
|
-
newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
|
|
1109
|
-
}
|
|
1110
|
-
this._inner.update(newT);
|
|
1111
|
-
},
|
|
1112
|
-
/**
|
|
1113
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1114
|
-
* @return {EaseElasticInOut}
|
|
1115
|
-
*/
|
|
1116
|
-
reverse: function () {
|
|
1117
|
-
return new EaseElasticInOut(this._inner.reverse(), this._period);
|
|
1118
|
-
},
|
|
1119
|
-
/**
|
|
1120
|
-
* to copy object with deep copy.
|
|
1121
|
-
* returns a clone of action.
|
|
1122
|
-
*
|
|
1123
|
-
* @returns {EaseElasticInOut}
|
|
1124
|
-
*/
|
|
1125
|
-
clone: function () {
|
|
1126
|
-
var action = new EaseElasticInOut();
|
|
1127
|
-
action.initWithAction(this._inner.clone(), this._period);
|
|
1128
|
-
return action;
|
|
1129
|
-
}
|
|
1130
|
-
});
|
|
1131
|
-
/**
|
|
1132
|
-
* Creates the action easing object with the period in radians (default is 0.3). <br />
|
|
1133
|
-
* Reference easeInOutElastic: <br />
|
|
1134
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1135
|
-
* @function
|
|
1136
|
-
* @param {Number} [period=0.3]
|
|
1137
|
-
* @return {Object}
|
|
1138
|
-
* @example
|
|
1139
|
-
* // example
|
|
1140
|
-
* action.easing(easeElasticInOut(3.0));
|
|
1141
|
-
*/
|
|
1142
|
-
export const easeElasticInOut = function (period) {
|
|
1143
|
-
period = period || 0.3;
|
|
1144
|
-
return {
|
|
1145
|
-
_period: period,
|
|
1146
|
-
easing: function (dt) {
|
|
1147
|
-
var newT = 0;
|
|
1148
|
-
var locPeriod = this._period;
|
|
1149
|
-
if (dt === 0 || dt === 1) {
|
|
1150
|
-
newT = dt;
|
|
1151
|
-
}
|
|
1152
|
-
else {
|
|
1153
|
-
dt = dt * 2;
|
|
1154
|
-
if (!locPeriod)
|
|
1155
|
-
locPeriod = this._period = 0.3 * 1.5;
|
|
1156
|
-
var s = locPeriod / 4;
|
|
1157
|
-
dt = dt - 1;
|
|
1158
|
-
if (dt < 0)
|
|
1159
|
-
newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
|
|
1160
|
-
else
|
|
1161
|
-
newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
|
|
1162
|
-
}
|
|
1163
|
-
return newT;
|
|
1164
|
-
},
|
|
1165
|
-
reverse: function () {
|
|
1166
|
-
return easeElasticInOut(this._period);
|
|
1167
|
-
}
|
|
1168
|
-
};
|
|
1169
|
-
};
|
|
1170
|
-
/**
|
|
1171
|
-
* EaseBounce abstract class.
|
|
1172
|
-
*
|
|
1173
|
-
* @deprecated since v3.0 Does not recommend the use of the base object.
|
|
1174
|
-
*
|
|
1175
|
-
* @class
|
|
1176
|
-
* @extends ActionEase
|
|
1177
|
-
*/
|
|
1178
|
-
export const EaseBounce = ActionEase.extend(/** @lends EaseBounce# */ {
|
|
1179
|
-
/**
|
|
1180
|
-
* @param {Number} time1
|
|
1181
|
-
* @return {Number}
|
|
1182
|
-
*/
|
|
1183
|
-
bounceTime: function (time1) {
|
|
1184
|
-
if (time1 < 1 / 2.75) {
|
|
1185
|
-
return 7.5625 * time1 * time1;
|
|
1186
|
-
}
|
|
1187
|
-
else if (time1 < 2 / 2.75) {
|
|
1188
|
-
time1 -= 1.5 / 2.75;
|
|
1189
|
-
return 7.5625 * time1 * time1 + 0.75;
|
|
1190
|
-
}
|
|
1191
|
-
else if (time1 < 2.5 / 2.75) {
|
|
1192
|
-
time1 -= 2.25 / 2.75;
|
|
1193
|
-
return 7.5625 * time1 * time1 + 0.9375;
|
|
1194
|
-
}
|
|
1195
|
-
time1 -= 2.625 / 2.75;
|
|
1196
|
-
return 7.5625 * time1 * time1 + 0.984375;
|
|
1197
|
-
},
|
|
1198
|
-
/**
|
|
1199
|
-
* to copy object with deep copy.
|
|
1200
|
-
* returns a clone of action.
|
|
1201
|
-
*
|
|
1202
|
-
* @returns {EaseBounce}
|
|
1203
|
-
*/
|
|
1204
|
-
clone: function () {
|
|
1205
|
-
var action = new EaseBounce();
|
|
1206
|
-
action.initWithAction(this._inner.clone());
|
|
1207
|
-
return action;
|
|
1208
|
-
},
|
|
1209
|
-
/**
|
|
1210
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1211
|
-
* @return {EaseBounce}
|
|
1212
|
-
*/
|
|
1213
|
-
reverse: function () {
|
|
1214
|
-
return new EaseBounce(this._inner.reverse());
|
|
1215
|
-
}
|
|
1216
|
-
});
|
|
1217
|
-
/**
|
|
1218
|
-
* EaseBounceIn action. <br />
|
|
1219
|
-
* Eased bounce effect at the beginning.
|
|
1220
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1221
|
-
* @class
|
|
1222
|
-
* @extends EaseBounce
|
|
1223
|
-
*
|
|
1224
|
-
* @deprecated since v3.0 please use action.easing(easeBounceIn())
|
|
1225
|
-
*
|
|
1226
|
-
* @example
|
|
1227
|
-
* //The old usage
|
|
1228
|
-
* EaseBounceIn.create(action);
|
|
1229
|
-
* //The new usage
|
|
1230
|
-
* action.easing(easeBounceIn());
|
|
1231
|
-
*/
|
|
1232
|
-
export const EaseBounceIn = EaseBounce.extend(/** @lends EaseBounceIn# */ {
|
|
1233
|
-
/**
|
|
1234
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1235
|
-
*
|
|
1236
|
-
* @param {Number} dt
|
|
1237
|
-
*/
|
|
1238
|
-
update: function (dt) {
|
|
1239
|
-
var newT = 1 - this.bounceTime(1 - dt);
|
|
1240
|
-
this._inner.update(newT);
|
|
1241
|
-
},
|
|
1242
|
-
/**
|
|
1243
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1244
|
-
* @return {EaseBounceOut}
|
|
1245
|
-
*/
|
|
1246
|
-
reverse: function () {
|
|
1247
|
-
return new EaseBounceOut(this._inner.reverse());
|
|
1248
|
-
},
|
|
1249
|
-
/**
|
|
1250
|
-
* to copy object with deep copy.
|
|
1251
|
-
* returns a clone of action.
|
|
1252
|
-
*
|
|
1253
|
-
* @returns {EaseBounceIn}
|
|
1254
|
-
*/
|
|
1255
|
-
clone: function () {
|
|
1256
|
-
var action = new EaseBounceIn();
|
|
1257
|
-
action.initWithAction(this._inner.clone());
|
|
1258
|
-
return action;
|
|
1259
|
-
}
|
|
1260
|
-
});
|
|
1261
|
-
export const _bounceTime = function (time1) {
|
|
1262
|
-
if (time1 < 1 / 2.75) {
|
|
1263
|
-
return 7.5625 * time1 * time1;
|
|
1264
|
-
}
|
|
1265
|
-
else if (time1 < 2 / 2.75) {
|
|
1266
|
-
time1 -= 1.5 / 2.75;
|
|
1267
|
-
return 7.5625 * time1 * time1 + 0.75;
|
|
1268
|
-
}
|
|
1269
|
-
else if (time1 < 2.5 / 2.75) {
|
|
1270
|
-
time1 -= 2.25 / 2.75;
|
|
1271
|
-
return 7.5625 * time1 * time1 + 0.9375;
|
|
1272
|
-
}
|
|
1273
|
-
time1 -= 2.625 / 2.75;
|
|
1274
|
-
return 7.5625 * time1 * time1 + 0.984375;
|
|
1275
|
-
};
|
|
1276
|
-
export const _easeBounceInObj = {
|
|
1277
|
-
easing: function (dt) {
|
|
1278
|
-
return 1 - _bounceTime(1 - dt);
|
|
1279
|
-
},
|
|
1280
|
-
reverse: function () {
|
|
1281
|
-
return _easeBounceOutObj;
|
|
1282
|
-
}
|
|
1283
|
-
};
|
|
1284
|
-
/**
|
|
1285
|
-
* Creates the action easing object. <br />
|
|
1286
|
-
* Eased bounce effect at the beginning.
|
|
1287
|
-
* @function
|
|
1288
|
-
* @return {Object}
|
|
1289
|
-
* @example
|
|
1290
|
-
* // example
|
|
1291
|
-
* action.easing(easeBounceIn());
|
|
1292
|
-
*/
|
|
1293
|
-
export const easeBounceIn = function () {
|
|
1294
|
-
return _easeBounceInObj;
|
|
1295
|
-
};
|
|
1296
|
-
/**
|
|
1297
|
-
* EaseBounceOut action. <br />
|
|
1298
|
-
* Eased bounce effect at the ending.
|
|
1299
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1300
|
-
* @class
|
|
1301
|
-
* @extends EaseBounce
|
|
1302
|
-
*
|
|
1303
|
-
* @deprecated since v3.0 please use action.easing(easeBounceOut())
|
|
1304
|
-
*
|
|
1305
|
-
* @example
|
|
1306
|
-
* //The old usage
|
|
1307
|
-
* EaseBounceOut.create(action);
|
|
1308
|
-
* //The new usage
|
|
1309
|
-
* action.easing(easeBounceOut());
|
|
1310
|
-
*/
|
|
1311
|
-
export const EaseBounceOut = EaseBounce.extend(/** @lends EaseBounceOut# */ {
|
|
1312
|
-
/**
|
|
1313
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1314
|
-
*
|
|
1315
|
-
* @param {Number} dt
|
|
1316
|
-
*/
|
|
1317
|
-
update: function (dt) {
|
|
1318
|
-
var newT = this.bounceTime(dt);
|
|
1319
|
-
this._inner.update(newT);
|
|
1320
|
-
},
|
|
1321
|
-
/**
|
|
1322
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1323
|
-
* @return {EaseBounceIn}
|
|
1324
|
-
*/
|
|
1325
|
-
reverse: function () {
|
|
1326
|
-
return new EaseBounceIn(this._inner.reverse());
|
|
1327
|
-
},
|
|
1328
|
-
/**
|
|
1329
|
-
* to copy object with deep copy.
|
|
1330
|
-
* returns a clone of action.
|
|
1331
|
-
*
|
|
1332
|
-
* @returns {EaseBounceOut}
|
|
1333
|
-
*/
|
|
1334
|
-
clone: function () {
|
|
1335
|
-
var action = new EaseBounceOut();
|
|
1336
|
-
action.initWithAction(this._inner.clone());
|
|
1337
|
-
return action;
|
|
1338
|
-
}
|
|
1339
|
-
});
|
|
1340
|
-
export const _easeBounceOutObj = {
|
|
1341
|
-
easing: function (dt) {
|
|
1342
|
-
return _bounceTime(dt);
|
|
1343
|
-
},
|
|
1344
|
-
reverse: function () {
|
|
1345
|
-
return _easeBounceInObj;
|
|
1346
|
-
}
|
|
1347
|
-
};
|
|
1348
|
-
/**
|
|
1349
|
-
* Creates the action easing object. <br />
|
|
1350
|
-
* Eased bounce effect at the ending.
|
|
1351
|
-
* @function
|
|
1352
|
-
* @return {Object}
|
|
1353
|
-
* @example
|
|
1354
|
-
* // example
|
|
1355
|
-
* action.easing(easeBounceOut());
|
|
1356
|
-
*/
|
|
1357
|
-
export const easeBounceOut = function () {
|
|
1358
|
-
return _easeBounceOutObj;
|
|
1359
|
-
};
|
|
1360
|
-
/**
|
|
1361
|
-
* EaseBounceInOut action. <br />
|
|
1362
|
-
* Eased bounce effect at the beginning and ending.
|
|
1363
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1364
|
-
* @class
|
|
1365
|
-
* @extends EaseBounce
|
|
1366
|
-
*
|
|
1367
|
-
* @deprecated since v3.0 <br /> Please use acton.easing(easeBounceInOut())
|
|
1368
|
-
*
|
|
1369
|
-
* @example
|
|
1370
|
-
* //The old usage
|
|
1371
|
-
* EaseBounceInOut.create(action);
|
|
1372
|
-
* //The new usage
|
|
1373
|
-
* action.easing(easeBounceInOut());
|
|
1374
|
-
*/
|
|
1375
|
-
export const EaseBounceInOut = EaseBounce.extend(/** @lends EaseBounceInOut# */ {
|
|
1376
|
-
/**
|
|
1377
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1378
|
-
*
|
|
1379
|
-
* @param {Number} dt
|
|
1380
|
-
*/
|
|
1381
|
-
update: function (dt) {
|
|
1382
|
-
var newT = 0;
|
|
1383
|
-
if (dt < 0.5) {
|
|
1384
|
-
dt = dt * 2;
|
|
1385
|
-
newT = (1 - this.bounceTime(1 - dt)) * 0.5;
|
|
1386
|
-
}
|
|
1387
|
-
else {
|
|
1388
|
-
newT = this.bounceTime(dt * 2 - 1) * 0.5 + 0.5;
|
|
1389
|
-
}
|
|
1390
|
-
this._inner.update(newT);
|
|
1391
|
-
},
|
|
1392
|
-
/**
|
|
1393
|
-
* to copy object with deep copy.
|
|
1394
|
-
* returns a clone of action.
|
|
1395
|
-
*
|
|
1396
|
-
* @returns {EaseBounceInOut}
|
|
1397
|
-
*/
|
|
1398
|
-
clone: function () {
|
|
1399
|
-
var action = new EaseBounceInOut();
|
|
1400
|
-
action.initWithAction(this._inner.clone());
|
|
1401
|
-
return action;
|
|
1402
|
-
},
|
|
1403
|
-
/**
|
|
1404
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1405
|
-
* @return {EaseBounceInOut}
|
|
1406
|
-
*/
|
|
1407
|
-
reverse: function () {
|
|
1408
|
-
return new EaseBounceInOut(this._inner.reverse());
|
|
1409
|
-
}
|
|
1410
|
-
});
|
|
1411
|
-
export const _easeBounceInOutObj = {
|
|
1412
|
-
easing: function (time1) {
|
|
1413
|
-
var newT;
|
|
1414
|
-
if (time1 < 0.5) {
|
|
1415
|
-
time1 = time1 * 2;
|
|
1416
|
-
newT = (1 - _bounceTime(1 - time1)) * 0.5;
|
|
1417
|
-
}
|
|
1418
|
-
else {
|
|
1419
|
-
newT = _bounceTime(time1 * 2 - 1) * 0.5 + 0.5;
|
|
1420
|
-
}
|
|
1421
|
-
return newT;
|
|
1422
|
-
},
|
|
1423
|
-
reverse: function () {
|
|
1424
|
-
return _easeBounceInOutObj;
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
/**
|
|
1428
|
-
* Creates the action easing object. <br />
|
|
1429
|
-
* Eased bounce effect at the beginning and ending.
|
|
1430
|
-
* @function
|
|
1431
|
-
* @return {Object}
|
|
1432
|
-
* @example
|
|
1433
|
-
* // example
|
|
1434
|
-
* action.easing(easeBounceInOut());
|
|
1435
|
-
*/
|
|
1436
|
-
export const easeBounceInOut = function () {
|
|
1437
|
-
return _easeBounceInOutObj;
|
|
1438
|
-
};
|
|
1439
|
-
/**
|
|
1440
|
-
* EaseBackIn action. <br />
|
|
1441
|
-
* In the opposite direction to move slowly, and then accelerated to the right direction.
|
|
1442
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1443
|
-
* @class
|
|
1444
|
-
* @extends ActionEase
|
|
1445
|
-
*
|
|
1446
|
-
* @deprecated since v3.0 please use action.easing(easeBackIn())
|
|
1447
|
-
*
|
|
1448
|
-
* @example
|
|
1449
|
-
* //The old usage
|
|
1450
|
-
* EaseBackIn.create(action);
|
|
1451
|
-
* //The new usage
|
|
1452
|
-
* action.easing(easeBackIn());
|
|
1453
|
-
*/
|
|
1454
|
-
export const EaseBackIn = ActionEase.extend(/** @lends EaseBackIn# */ {
|
|
1455
|
-
/**
|
|
1456
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1457
|
-
*
|
|
1458
|
-
* @param {Number} dt
|
|
1459
|
-
*/
|
|
1460
|
-
update: function (dt) {
|
|
1461
|
-
var overshoot = 1.70158;
|
|
1462
|
-
dt = dt === 0 || dt === 1 ? dt : dt * dt * ((overshoot + 1) * dt - overshoot);
|
|
1463
|
-
this._inner.update(dt);
|
|
1464
|
-
},
|
|
1465
|
-
/**
|
|
1466
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1467
|
-
* @return {EaseBackOut}
|
|
1468
|
-
*/
|
|
1469
|
-
reverse: function () {
|
|
1470
|
-
return new EaseBackOut(this._inner.reverse());
|
|
1471
|
-
},
|
|
1472
|
-
/**
|
|
1473
|
-
* to copy object with deep copy.
|
|
1474
|
-
* returns a clone of action.
|
|
1475
|
-
*
|
|
1476
|
-
* @returns {EaseBackIn}
|
|
1477
|
-
*/
|
|
1478
|
-
clone: function () {
|
|
1479
|
-
var action = new EaseBackIn();
|
|
1480
|
-
action.initWithAction(this._inner.clone());
|
|
1481
|
-
return action;
|
|
1482
|
-
}
|
|
1483
|
-
});
|
|
1484
|
-
export const _easeBackInObj = {
|
|
1485
|
-
easing: function (time1) {
|
|
1486
|
-
var overshoot = 1.70158;
|
|
1487
|
-
return (time1 === 0 || time1 === 1) ? time1 : time1 * time1 * ((overshoot + 1) * time1 - overshoot);
|
|
1488
|
-
},
|
|
1489
|
-
reverse: function () {
|
|
1490
|
-
return _easeBackOutObj;
|
|
1491
|
-
}
|
|
1492
|
-
};
|
|
1493
|
-
/**
|
|
1494
|
-
* Creates the action easing object. <br />
|
|
1495
|
-
* In the opposite direction to move slowly, and then accelerated to the right direction.
|
|
1496
|
-
* @function
|
|
1497
|
-
* @return {Object}
|
|
1498
|
-
* @example
|
|
1499
|
-
* // example
|
|
1500
|
-
* action.easing(easeBackIn());
|
|
1501
|
-
*/
|
|
1502
|
-
export const easeBackIn = function () {
|
|
1503
|
-
return _easeBackInObj;
|
|
1504
|
-
};
|
|
1505
|
-
/**
|
|
1506
|
-
* EaseBackOut action. <br />
|
|
1507
|
-
* Fast moving more than the finish, and then slowly back to the finish.
|
|
1508
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1509
|
-
* @class
|
|
1510
|
-
* @extends ActionEase
|
|
1511
|
-
*
|
|
1512
|
-
* @deprecated since v3.0 please use action.easing(easeBackOut());
|
|
1513
|
-
*
|
|
1514
|
-
* @example
|
|
1515
|
-
* //The old usage
|
|
1516
|
-
* EaseBackOut.create(action);
|
|
1517
|
-
* //The new usage
|
|
1518
|
-
* action.easing(easeBackOut());
|
|
1519
|
-
*/
|
|
1520
|
-
export const EaseBackOut = ActionEase.extend(/** @lends EaseBackOut# */ {
|
|
1521
|
-
/**
|
|
1522
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1523
|
-
*
|
|
1524
|
-
* @param {Number} dt
|
|
1525
|
-
*/
|
|
1526
|
-
update: function (dt) {
|
|
1527
|
-
var overshoot = 1.70158;
|
|
1528
|
-
dt = dt - 1;
|
|
1529
|
-
this._inner.update(dt * dt * ((overshoot + 1) * dt + overshoot) + 1);
|
|
1530
|
-
},
|
|
1531
|
-
/**
|
|
1532
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1533
|
-
* @return {EaseBackIn}
|
|
1534
|
-
*/
|
|
1535
|
-
reverse: function () {
|
|
1536
|
-
return new EaseBackIn(this._inner.reverse());
|
|
1537
|
-
},
|
|
1538
|
-
/**
|
|
1539
|
-
* to copy object with deep copy.
|
|
1540
|
-
* returns a clone of action.
|
|
1541
|
-
*
|
|
1542
|
-
* @returns {EaseBackOut}
|
|
1543
|
-
*/
|
|
1544
|
-
clone: function () {
|
|
1545
|
-
var action = new EaseBackOut();
|
|
1546
|
-
action.initWithAction(this._inner.clone());
|
|
1547
|
-
return action;
|
|
1548
|
-
}
|
|
1549
|
-
});
|
|
1550
|
-
export const _easeBackOutObj = {
|
|
1551
|
-
easing: function (time1) {
|
|
1552
|
-
var overshoot = 1.70158;
|
|
1553
|
-
time1 = time1 - 1;
|
|
1554
|
-
return time1 * time1 * ((overshoot + 1) * time1 + overshoot) + 1;
|
|
1555
|
-
},
|
|
1556
|
-
reverse: function () {
|
|
1557
|
-
return _easeBackInObj;
|
|
1558
|
-
}
|
|
1559
|
-
};
|
|
1560
|
-
/**
|
|
1561
|
-
* Creates the action easing object. <br />
|
|
1562
|
-
* Fast moving more than the finish, and then slowly back to the finish.
|
|
1563
|
-
* @function
|
|
1564
|
-
* @return {Object}
|
|
1565
|
-
* @example
|
|
1566
|
-
* // example
|
|
1567
|
-
* action.easing(easeBackOut());
|
|
1568
|
-
*/
|
|
1569
|
-
export const easeBackOut = function () {
|
|
1570
|
-
return _easeBackOutObj;
|
|
1571
|
-
};
|
|
1572
|
-
/**
|
|
1573
|
-
* EaseBackInOut action. <br />
|
|
1574
|
-
* Beginning of EaseBackIn. Ending of EaseBackOut.
|
|
1575
|
-
* @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
|
|
1576
|
-
* @class
|
|
1577
|
-
* @extends ActionEase
|
|
1578
|
-
*
|
|
1579
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeBackInOut())
|
|
1580
|
-
*
|
|
1581
|
-
* @example
|
|
1582
|
-
* //The old usage
|
|
1583
|
-
* EaseBackInOut.create(action);
|
|
1584
|
-
* //The new usage
|
|
1585
|
-
* action.easing(easeBackInOut());
|
|
1586
|
-
*/
|
|
1587
|
-
export const EaseBackInOut = ActionEase.extend(/** @lends EaseBackInOut# */ {
|
|
1588
|
-
/**
|
|
1589
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1590
|
-
*
|
|
1591
|
-
* @param {Number} dt
|
|
1592
|
-
*/
|
|
1593
|
-
update: function (dt) {
|
|
1594
|
-
var overshoot = 1.70158 * 1.525;
|
|
1595
|
-
dt = dt * 2;
|
|
1596
|
-
if (dt < 1) {
|
|
1597
|
-
this._inner.update((dt * dt * ((overshoot + 1) * dt - overshoot)) / 2);
|
|
1598
|
-
}
|
|
1599
|
-
else {
|
|
1600
|
-
dt = dt - 2;
|
|
1601
|
-
this._inner.update((dt * dt * ((overshoot + 1) * dt + overshoot)) / 2 + 1);
|
|
1602
|
-
}
|
|
1603
|
-
},
|
|
1604
|
-
/**
|
|
1605
|
-
* to copy object with deep copy.
|
|
1606
|
-
* returns a clone of action.
|
|
1607
|
-
*
|
|
1608
|
-
* @returns {EaseBackInOut}
|
|
1609
|
-
*/
|
|
1610
|
-
clone: function () {
|
|
1611
|
-
var action = new EaseBackInOut();
|
|
1612
|
-
action.initWithAction(this._inner.clone());
|
|
1613
|
-
return action;
|
|
1614
|
-
},
|
|
1615
|
-
/**
|
|
1616
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1617
|
-
* @return {EaseBackInOut}
|
|
1618
|
-
*/
|
|
1619
|
-
reverse: function () {
|
|
1620
|
-
return new EaseBackInOut(this._inner.reverse());
|
|
1621
|
-
}
|
|
1622
|
-
});
|
|
1623
|
-
export const _easeBackInOutObj = {
|
|
1624
|
-
easing: function (time1) {
|
|
1625
|
-
var overshoot = 1.70158 * 1.525;
|
|
1626
|
-
time1 = time1 * 2;
|
|
1627
|
-
if (time1 < 1) {
|
|
1628
|
-
return (time1 * time1 * ((overshoot + 1) * time1 - overshoot)) / 2;
|
|
1629
|
-
}
|
|
1630
|
-
else {
|
|
1631
|
-
time1 = time1 - 2;
|
|
1632
|
-
return (time1 * time1 * ((overshoot + 1) * time1 + overshoot)) / 2 + 1;
|
|
1633
|
-
}
|
|
1634
|
-
},
|
|
1635
|
-
reverse: function () {
|
|
1636
|
-
return _easeBackInOutObj;
|
|
1637
|
-
}
|
|
1638
|
-
};
|
|
1639
|
-
/**
|
|
1640
|
-
* Creates the action easing object. <br />
|
|
1641
|
-
* Beginning of EaseBackIn. Ending of EaseBackOut.
|
|
1642
|
-
* @function
|
|
1643
|
-
* @return {Object}
|
|
1644
|
-
* @example
|
|
1645
|
-
* // example
|
|
1646
|
-
* action.easing(easeBackInOut());
|
|
1647
|
-
*/
|
|
1648
|
-
export const easeBackInOut = function () {
|
|
1649
|
-
return _easeBackInOutObj;
|
|
1650
|
-
};
|
|
1651
|
-
/**
|
|
1652
|
-
* EaseBezierAction action. <br />
|
|
1653
|
-
* Manually set a 4 order Bessel curve. <br />
|
|
1654
|
-
* According to the set point, calculate the trajectory.
|
|
1655
|
-
* @class
|
|
1656
|
-
* @extends ActionEase
|
|
1657
|
-
* @param {Action} action
|
|
1658
|
-
*
|
|
1659
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeBezierAction())
|
|
1660
|
-
*
|
|
1661
|
-
* @example
|
|
1662
|
-
* //The old usage
|
|
1663
|
-
* var action = EaseBezierAction.create(action);
|
|
1664
|
-
* action.setBezierParamer(0.5, 0.5, 1.0, 1.0);
|
|
1665
|
-
* //The new usage
|
|
1666
|
-
* action.easing(easeBezierAction(0.5, 0.5, 1.0, 1.0));
|
|
1667
|
-
*/
|
|
1668
|
-
export const EaseBezierAction = ActionEase.extend(/** @lends EaseBezierAction# */ {
|
|
1669
|
-
_p0: null,
|
|
1670
|
-
_p1: null,
|
|
1671
|
-
_p2: null,
|
|
1672
|
-
_p3: null,
|
|
1673
|
-
/**
|
|
1674
|
-
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
|
1675
|
-
* Initialization requires the application of Bessel curve of action.
|
|
1676
|
-
* @param {Action} action
|
|
1677
|
-
*/
|
|
1678
|
-
ctor: function (action) {
|
|
1679
|
-
ActionEase.prototype.ctor.call(this, action);
|
|
1680
|
-
},
|
|
1681
|
-
_updateTime: function (a, b, c, d, t) {
|
|
1682
|
-
return (Math.pow(1 - t, 3) * a + 3 * t * (Math.pow(1 - t, 2)) * b + 3 * Math.pow(t, 2) * (1 - t) * c + Math.pow(t, 3) * d);
|
|
1683
|
-
},
|
|
1684
|
-
/**
|
|
1685
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1686
|
-
*
|
|
1687
|
-
* @param {Number} dt
|
|
1688
|
-
*/
|
|
1689
|
-
update: function (dt) {
|
|
1690
|
-
var t = this._updateTime(this._p0, this._p1, this._p2, this._p3, dt);
|
|
1691
|
-
this._inner.update(t);
|
|
1692
|
-
},
|
|
1693
|
-
/**
|
|
1694
|
-
* to copy object with deep copy.
|
|
1695
|
-
* returns a clone of action.
|
|
1696
|
-
*
|
|
1697
|
-
* @returns {EaseBezierAction}
|
|
1698
|
-
*/
|
|
1699
|
-
clone: function () {
|
|
1700
|
-
var action = new EaseBezierAction();
|
|
1701
|
-
action.initWithAction(this._inner.clone());
|
|
1702
|
-
action.setBezierParamer(this._p0, this._p1, this._p2, this._p3);
|
|
1703
|
-
return action;
|
|
1704
|
-
},
|
|
1705
|
-
/**
|
|
1706
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1707
|
-
* @return {EaseBezierAction}
|
|
1708
|
-
*/
|
|
1709
|
-
reverse: function () {
|
|
1710
|
-
var action = new EaseBezierAction(this._inner.reverse());
|
|
1711
|
-
action.setBezierParamer(this._p3, this._p2, this._p1, this._p0);
|
|
1712
|
-
return action;
|
|
1713
|
-
},
|
|
1714
|
-
/**
|
|
1715
|
-
* Set of 4 reference point
|
|
1716
|
-
* @param p0
|
|
1717
|
-
* @param p1
|
|
1718
|
-
* @param p2
|
|
1719
|
-
* @param p3
|
|
1720
|
-
*/
|
|
1721
|
-
setBezierParamer: function (p0, p1, p2, p3) {
|
|
1722
|
-
this._p0 = p0 || 0;
|
|
1723
|
-
this._p1 = p1 || 0;
|
|
1724
|
-
this._p2 = p2 || 0;
|
|
1725
|
-
this._p3 = p3 || 0;
|
|
1726
|
-
}
|
|
1727
|
-
});
|
|
1728
|
-
/**
|
|
1729
|
-
* Creates the action. <br />
|
|
1730
|
-
* After creating the EaseBezierAction, also need to manually call setBezierParamer. <br />
|
|
1731
|
-
* According to the set point, calculate the trajectory.
|
|
1732
|
-
* @static
|
|
1733
|
-
* @param action
|
|
1734
|
-
* @returns {EaseBezierAction}
|
|
1735
|
-
*
|
|
1736
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeBezierAction())
|
|
1737
|
-
*
|
|
1738
|
-
* @example
|
|
1739
|
-
* //The old usage
|
|
1740
|
-
* var action = EaseBezierAction.create(action);
|
|
1741
|
-
* action.setBezierParamer(0.5, 0.5, 1.0, 1.0);
|
|
1742
|
-
* //The new usage
|
|
1743
|
-
* action.easing(easeBezierAction(0.5, 0.5, 1.0, 1.0));
|
|
1744
|
-
*/
|
|
1745
|
-
EaseBezierAction.create = function (action) {
|
|
1746
|
-
return new EaseBezierAction(action);
|
|
1747
|
-
};
|
|
1748
|
-
/**
|
|
1749
|
-
* Creates the action easing object. <br />
|
|
1750
|
-
* Into the 4 reference point. <br />
|
|
1751
|
-
* To calculate the motion curve.
|
|
1752
|
-
* @param {Number} p0 The first bezier parameter
|
|
1753
|
-
* @param {Number} p1 The second bezier parameter
|
|
1754
|
-
* @param {Number} p2 The third bezier parameter
|
|
1755
|
-
* @param {Number} p3 The fourth bezier parameter
|
|
1756
|
-
* @returns {Object}
|
|
1757
|
-
* @example
|
|
1758
|
-
* // example
|
|
1759
|
-
* action.easing(easeBezierAction(0.5, 0.5, 1.0, 1.0));
|
|
1760
|
-
*/
|
|
1761
|
-
export const easeBezierAction = function (p0, p1, p2, p3) {
|
|
1762
|
-
return {
|
|
1763
|
-
easing: function (time) {
|
|
1764
|
-
return EaseBezierAction.prototype._updateTime(p0, p1, p2, p3, time);
|
|
1765
|
-
},
|
|
1766
|
-
reverse: function () {
|
|
1767
|
-
return easeBezierAction(p3, p2, p1, p0);
|
|
1768
|
-
}
|
|
1769
|
-
};
|
|
1770
|
-
};
|
|
1771
|
-
/**
|
|
1772
|
-
* EaseQuadraticActionIn action. <br />
|
|
1773
|
-
* Reference easeInQuad: <br />
|
|
1774
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1775
|
-
* @class
|
|
1776
|
-
* @extends ActionEase
|
|
1777
|
-
*
|
|
1778
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuadraticAction())
|
|
1779
|
-
*
|
|
1780
|
-
* @example
|
|
1781
|
-
* //The old usage
|
|
1782
|
-
* EaseQuadraticActionIn.create(action);
|
|
1783
|
-
* //The new usage
|
|
1784
|
-
* action.easing(easeQuadraticActionIn());
|
|
1785
|
-
*/
|
|
1786
|
-
export const EaseQuadraticActionIn = ActionEase.extend(/** @lends EaseQuadraticActionIn# */ {
|
|
1787
|
-
_updateTime: function (time) {
|
|
1788
|
-
return Math.pow(time, 2);
|
|
1789
|
-
},
|
|
1790
|
-
/**
|
|
1791
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1792
|
-
*
|
|
1793
|
-
* @param {Number} dt
|
|
1794
|
-
*/
|
|
1795
|
-
update: function (dt) {
|
|
1796
|
-
this._inner.update(this._updateTime(dt));
|
|
1797
|
-
},
|
|
1798
|
-
/**
|
|
1799
|
-
* to copy object with deep copy.
|
|
1800
|
-
* returns a clone of action.
|
|
1801
|
-
*
|
|
1802
|
-
* @returns {EaseQuadraticActionIn}
|
|
1803
|
-
*/
|
|
1804
|
-
clone: function () {
|
|
1805
|
-
var action = new EaseQuadraticActionIn();
|
|
1806
|
-
action.initWithAction(this._inner.clone());
|
|
1807
|
-
return action;
|
|
1808
|
-
},
|
|
1809
|
-
/**
|
|
1810
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1811
|
-
* @return {EaseQuadraticActionIn}
|
|
1812
|
-
*/
|
|
1813
|
-
reverse: function () {
|
|
1814
|
-
return new EaseQuadraticActionIn(this._inner.reverse());
|
|
1815
|
-
}
|
|
1816
|
-
});
|
|
1817
|
-
export const _easeQuadraticActionIn = {
|
|
1818
|
-
easing: EaseQuadraticActionIn.prototype._updateTime,
|
|
1819
|
-
reverse: function () {
|
|
1820
|
-
return _easeQuadraticActionIn;
|
|
1821
|
-
}
|
|
1822
|
-
};
|
|
1823
|
-
/**
|
|
1824
|
-
* Creates the action easing object. <br />
|
|
1825
|
-
* Reference easeInQuad: <br />
|
|
1826
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1827
|
-
* @returns {Object}
|
|
1828
|
-
* @example
|
|
1829
|
-
* //example
|
|
1830
|
-
* action.easing(easeQuadraticActionIn());
|
|
1831
|
-
*/
|
|
1832
|
-
export const easeQuadraticActionIn = function () {
|
|
1833
|
-
return _easeQuadraticActionIn;
|
|
1834
|
-
};
|
|
1835
|
-
/**
|
|
1836
|
-
* EaseQuadraticActionIn action. <br />
|
|
1837
|
-
* Reference easeOutQuad: <br />
|
|
1838
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1839
|
-
* @class
|
|
1840
|
-
* @extends ActionEase
|
|
1841
|
-
*
|
|
1842
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuadraticActionOut())
|
|
1843
|
-
*
|
|
1844
|
-
* @example
|
|
1845
|
-
* //The old usage
|
|
1846
|
-
* EaseQuadraticActionOut.create(action);
|
|
1847
|
-
* //The new usage
|
|
1848
|
-
* action.easing(easeQuadraticActionOut());
|
|
1849
|
-
*/
|
|
1850
|
-
export const EaseQuadraticActionOut = ActionEase.extend(/** @lends EaseQuadraticActionOut# */ {
|
|
1851
|
-
_updateTime: function (time) {
|
|
1852
|
-
return -time * (time - 2);
|
|
1853
|
-
},
|
|
1854
|
-
/**
|
|
1855
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1856
|
-
*
|
|
1857
|
-
* @param {Number} dt
|
|
1858
|
-
*/
|
|
1859
|
-
update: function (dt) {
|
|
1860
|
-
this._inner.update(this._updateTime(dt));
|
|
1861
|
-
},
|
|
1862
|
-
/**
|
|
1863
|
-
* to copy object with deep copy.
|
|
1864
|
-
* returns a clone of action.
|
|
1865
|
-
*
|
|
1866
|
-
* @returns {EaseQuadraticActionOut}
|
|
1867
|
-
*/
|
|
1868
|
-
clone: function () {
|
|
1869
|
-
var action = new EaseQuadraticActionOut();
|
|
1870
|
-
action.initWithAction();
|
|
1871
|
-
return action;
|
|
1872
|
-
},
|
|
1873
|
-
/**
|
|
1874
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1875
|
-
* @return {EaseQuadraticActionOut}
|
|
1876
|
-
*/
|
|
1877
|
-
reverse: function () {
|
|
1878
|
-
return new EaseQuadraticActionOut(this._inner.reverse());
|
|
1879
|
-
}
|
|
1880
|
-
});
|
|
1881
|
-
export const _easeQuadraticActionOut = {
|
|
1882
|
-
easing: EaseQuadraticActionOut.prototype._updateTime,
|
|
1883
|
-
reverse: function () {
|
|
1884
|
-
return _easeQuadraticActionOut;
|
|
1885
|
-
}
|
|
1886
|
-
};
|
|
1887
|
-
/**
|
|
1888
|
-
* Creates the action easing object. <br />
|
|
1889
|
-
* Reference easeOutQuad: <br />
|
|
1890
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1891
|
-
* @function
|
|
1892
|
-
* @returns {Object}
|
|
1893
|
-
* @example
|
|
1894
|
-
* //example
|
|
1895
|
-
* action.easing(easeQuadraticActionOut());
|
|
1896
|
-
*/
|
|
1897
|
-
export const easeQuadraticActionOut = function () {
|
|
1898
|
-
return _easeQuadraticActionOut;
|
|
1899
|
-
};
|
|
1900
|
-
/**
|
|
1901
|
-
* EaseQuadraticActionInOut action. <br />
|
|
1902
|
-
* Reference easeInOutQuad: <br />
|
|
1903
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1904
|
-
* @class
|
|
1905
|
-
* @extends ActionEase
|
|
1906
|
-
*
|
|
1907
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuadraticActionInOut())
|
|
1908
|
-
*
|
|
1909
|
-
* @example
|
|
1910
|
-
* //The old usage
|
|
1911
|
-
* EaseQuadraticActionInOut.create(action);
|
|
1912
|
-
* //The new usage
|
|
1913
|
-
* action.easing(easeQuadraticActionInOut());
|
|
1914
|
-
*/
|
|
1915
|
-
export const EaseQuadraticActionInOut = ActionEase.extend(/** @lends EaseQuadraticActionInOut# */ {
|
|
1916
|
-
_updateTime: function (time) {
|
|
1917
|
-
var resultTime = time;
|
|
1918
|
-
time *= 2;
|
|
1919
|
-
if (time < 1) {
|
|
1920
|
-
resultTime = time * time * 0.5;
|
|
1921
|
-
}
|
|
1922
|
-
else {
|
|
1923
|
-
--time;
|
|
1924
|
-
resultTime = -0.5 * (time * (time - 2) - 1);
|
|
1925
|
-
}
|
|
1926
|
-
return resultTime;
|
|
1927
|
-
},
|
|
1928
|
-
/**
|
|
1929
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1930
|
-
*
|
|
1931
|
-
* @param {Number} dt
|
|
1932
|
-
*/
|
|
1933
|
-
update: function (dt) {
|
|
1934
|
-
this._inner.update(this._updateTime(dt));
|
|
1935
|
-
},
|
|
1936
|
-
/**
|
|
1937
|
-
* to copy object with deep copy.
|
|
1938
|
-
* returns a clone of action.
|
|
1939
|
-
*
|
|
1940
|
-
* @returns {EaseQuadraticActionInOut}
|
|
1941
|
-
*/
|
|
1942
|
-
clone: function () {
|
|
1943
|
-
var action = new EaseQuadraticActionInOut();
|
|
1944
|
-
action.initWithAction(this._inner.clone());
|
|
1945
|
-
return action;
|
|
1946
|
-
},
|
|
1947
|
-
/**
|
|
1948
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
1949
|
-
* @return {EaseQuadraticActionInOut}
|
|
1950
|
-
*/
|
|
1951
|
-
reverse: function () {
|
|
1952
|
-
return new EaseQuadraticActionInOut(this._inner.reverse());
|
|
1953
|
-
}
|
|
1954
|
-
});
|
|
1955
|
-
export const _easeQuadraticActionInOut = {
|
|
1956
|
-
easing: EaseQuadraticActionInOut.prototype._updateTime,
|
|
1957
|
-
reverse: function () {
|
|
1958
|
-
return _easeQuadraticActionInOut;
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
/**
|
|
1962
|
-
* Creates the action easing object. <br />
|
|
1963
|
-
* Reference easeInOutQuad: <br />
|
|
1964
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1965
|
-
* @function
|
|
1966
|
-
* @returns {Object}
|
|
1967
|
-
* @example
|
|
1968
|
-
* //example
|
|
1969
|
-
* action.easing(easeQuadraticActionInOut());
|
|
1970
|
-
*/
|
|
1971
|
-
export const easeQuadraticActionInOut = function () {
|
|
1972
|
-
return _easeQuadraticActionInOut;
|
|
1973
|
-
};
|
|
1974
|
-
/**
|
|
1975
|
-
* EaseQuarticActionIn action. <br />
|
|
1976
|
-
* Reference easeInQuart: <br />
|
|
1977
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
1978
|
-
* @class
|
|
1979
|
-
* @extends ActionEase
|
|
1980
|
-
*
|
|
1981
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuarticActionIn());
|
|
1982
|
-
*
|
|
1983
|
-
* @example
|
|
1984
|
-
* //The old usage
|
|
1985
|
-
* EaseQuarticActionIn.create(action);
|
|
1986
|
-
* //The new usage
|
|
1987
|
-
* action.easing(easeQuarticActionIn());
|
|
1988
|
-
*/
|
|
1989
|
-
export const EaseQuarticActionIn = ActionEase.extend(/** @lends EaseQuarticActionIn# */ {
|
|
1990
|
-
_updateTime: function (time) {
|
|
1991
|
-
return time * time * time * time;
|
|
1992
|
-
},
|
|
1993
|
-
/**
|
|
1994
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
1995
|
-
*
|
|
1996
|
-
* @param {Number} dt
|
|
1997
|
-
*/
|
|
1998
|
-
update: function (dt) {
|
|
1999
|
-
this._inner.update(this._updateTime(dt));
|
|
2000
|
-
},
|
|
2001
|
-
/**
|
|
2002
|
-
* to copy object with deep copy.
|
|
2003
|
-
* returns a clone of action.
|
|
2004
|
-
*
|
|
2005
|
-
* @returns {EaseQuarticActionIn}
|
|
2006
|
-
*/
|
|
2007
|
-
clone: function () {
|
|
2008
|
-
var action = new EaseQuarticActionIn();
|
|
2009
|
-
action.initWithAction(this._inner.clone());
|
|
2010
|
-
return action;
|
|
2011
|
-
},
|
|
2012
|
-
/**
|
|
2013
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2014
|
-
* @return {EaseQuarticActionIn}
|
|
2015
|
-
*/
|
|
2016
|
-
reverse: function () {
|
|
2017
|
-
return new EaseQuarticActionIn(this._inner.reverse());
|
|
2018
|
-
}
|
|
2019
|
-
});
|
|
2020
|
-
export const _easeQuarticActionIn = {
|
|
2021
|
-
easing: EaseQuarticActionIn.prototype._updateTime,
|
|
2022
|
-
reverse: function () {
|
|
2023
|
-
return _easeQuarticActionIn;
|
|
2024
|
-
}
|
|
2025
|
-
};
|
|
2026
|
-
/**
|
|
2027
|
-
* Creates the action easing object. <br />
|
|
2028
|
-
* Reference easeIntQuart: <br />
|
|
2029
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2030
|
-
* @function
|
|
2031
|
-
* @returns {Object}
|
|
2032
|
-
* @example
|
|
2033
|
-
* //example
|
|
2034
|
-
* action.easing(easeQuarticActionIn());
|
|
2035
|
-
*/
|
|
2036
|
-
export const easeQuarticActionIn = function () {
|
|
2037
|
-
return _easeQuarticActionIn;
|
|
2038
|
-
};
|
|
2039
|
-
/**
|
|
2040
|
-
* EaseQuarticActionOut action. <br />
|
|
2041
|
-
* Reference easeOutQuart: <br />
|
|
2042
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2043
|
-
* @class
|
|
2044
|
-
* @extends ActionEase
|
|
2045
|
-
*
|
|
2046
|
-
* @deprecated since v3.0 <br /> Please use action.easing(QuarticActionOut());
|
|
2047
|
-
*
|
|
2048
|
-
* @example
|
|
2049
|
-
* //The old usage
|
|
2050
|
-
* EaseQuarticActionOut.create(action);
|
|
2051
|
-
* //The new usage
|
|
2052
|
-
* action.easing(EaseQuarticActionOut());
|
|
2053
|
-
*/
|
|
2054
|
-
export const EaseQuarticActionOut = ActionEase.extend(/** @lends EaseQuarticActionOut# */ {
|
|
2055
|
-
_updateTime: function (time) {
|
|
2056
|
-
time -= 1;
|
|
2057
|
-
return -(time * time * time * time - 1);
|
|
2058
|
-
},
|
|
2059
|
-
/**
|
|
2060
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2061
|
-
*
|
|
2062
|
-
* @param {Number} dt
|
|
2063
|
-
*/
|
|
2064
|
-
update: function (dt) {
|
|
2065
|
-
this._inner.update(this._updateTime(dt));
|
|
2066
|
-
},
|
|
2067
|
-
/**
|
|
2068
|
-
* to copy object with deep copy.
|
|
2069
|
-
* returns a clone of action.
|
|
2070
|
-
*
|
|
2071
|
-
* @returns {EaseQuarticActionOut}
|
|
2072
|
-
*/
|
|
2073
|
-
clone: function () {
|
|
2074
|
-
var action = new EaseQuarticActionOut();
|
|
2075
|
-
action.initWithAction(this._inner.clone());
|
|
2076
|
-
return action;
|
|
2077
|
-
},
|
|
2078
|
-
/**
|
|
2079
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2080
|
-
* @return {EaseQuarticActionOut}
|
|
2081
|
-
*/
|
|
2082
|
-
reverse: function () {
|
|
2083
|
-
return new EaseQuarticActionOut(this._inner.reverse());
|
|
2084
|
-
}
|
|
2085
|
-
});
|
|
2086
|
-
export const _easeQuarticActionOut = {
|
|
2087
|
-
easing: EaseQuarticActionOut.prototype._updateTime,
|
|
2088
|
-
reverse: function () {
|
|
2089
|
-
return _easeQuarticActionOut;
|
|
2090
|
-
}
|
|
2091
|
-
};
|
|
2092
|
-
/**
|
|
2093
|
-
* Creates the action easing object. <br />
|
|
2094
|
-
* Reference easeOutQuart: <br />
|
|
2095
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2096
|
-
* @function
|
|
2097
|
-
* @returns {Object}
|
|
2098
|
-
* @example
|
|
2099
|
-
* //example
|
|
2100
|
-
* action.easing(QuarticActionOut());
|
|
2101
|
-
*/
|
|
2102
|
-
export const easeQuarticActionOut = function () {
|
|
2103
|
-
return _easeQuarticActionOut;
|
|
2104
|
-
};
|
|
2105
|
-
/**
|
|
2106
|
-
* EaseQuarticActionInOut action. <br />
|
|
2107
|
-
* Reference easeInOutQuart: <br />
|
|
2108
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2109
|
-
* @class
|
|
2110
|
-
* @extends ActionEase
|
|
2111
|
-
*
|
|
2112
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuarticActionInOut());
|
|
2113
|
-
*
|
|
2114
|
-
* @example
|
|
2115
|
-
* //The old usage
|
|
2116
|
-
* EaseQuarticActionInOut.create(action);
|
|
2117
|
-
* //The new usage
|
|
2118
|
-
* action.easing(easeQuarticActionInOut());
|
|
2119
|
-
*/
|
|
2120
|
-
export const EaseQuarticActionInOut = ActionEase.extend(/** @lends EaseQuarticActionInOut# */ {
|
|
2121
|
-
_updateTime: function (time) {
|
|
2122
|
-
time = time * 2;
|
|
2123
|
-
if (time < 1)
|
|
2124
|
-
return 0.5 * time * time * time * time;
|
|
2125
|
-
time -= 2;
|
|
2126
|
-
return -0.5 * (time * time * time * time - 2);
|
|
2127
|
-
},
|
|
2128
|
-
/**
|
|
2129
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2130
|
-
*
|
|
2131
|
-
* @param {Number} dt
|
|
2132
|
-
*/
|
|
2133
|
-
update: function (dt) {
|
|
2134
|
-
this._inner.update(this._updateTime(dt));
|
|
2135
|
-
},
|
|
2136
|
-
/**
|
|
2137
|
-
* to copy object with deep copy.
|
|
2138
|
-
* returns a clone of action.
|
|
2139
|
-
*
|
|
2140
|
-
* @returns {EaseQuarticActionInOut}
|
|
2141
|
-
*/
|
|
2142
|
-
clone: function () {
|
|
2143
|
-
var action = new EaseQuarticActionInOut();
|
|
2144
|
-
action.initWithAction(this._inner.clone());
|
|
2145
|
-
return action;
|
|
2146
|
-
},
|
|
2147
|
-
/**
|
|
2148
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2149
|
-
* @return {EaseQuarticActionInOut}
|
|
2150
|
-
*/
|
|
2151
|
-
reverse: function () {
|
|
2152
|
-
return new EaseQuarticActionInOut(this._inner.reverse());
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
export const _easeQuarticActionInOut = {
|
|
2156
|
-
easing: EaseQuarticActionInOut.prototype._updateTime,
|
|
2157
|
-
reverse: function () {
|
|
2158
|
-
return _easeQuarticActionInOut;
|
|
2159
|
-
}
|
|
2160
|
-
};
|
|
2161
|
-
/**
|
|
2162
|
-
* Creates the action easing object. <br />
|
|
2163
|
-
* Reference easeInOutQuart: <br />
|
|
2164
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2165
|
-
* @function
|
|
2166
|
-
* @returns {Object}
|
|
2167
|
-
*/
|
|
2168
|
-
export const easeQuarticActionInOut = function () {
|
|
2169
|
-
return _easeQuarticActionInOut;
|
|
2170
|
-
};
|
|
2171
|
-
/**
|
|
2172
|
-
* EaseQuinticActionIn action. <br />
|
|
2173
|
-
* Reference easeInQuint: <br />
|
|
2174
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2175
|
-
* @class
|
|
2176
|
-
* @extends ActionEase
|
|
2177
|
-
*
|
|
2178
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuinticActionIn());
|
|
2179
|
-
*
|
|
2180
|
-
* @example
|
|
2181
|
-
* //The old usage
|
|
2182
|
-
* EaseQuinticActionIn.create(action);
|
|
2183
|
-
* //The new usage
|
|
2184
|
-
* action.easing(easeQuinticActionIn());
|
|
2185
|
-
*/
|
|
2186
|
-
export const EaseQuinticActionIn = ActionEase.extend(/** @lends EaseQuinticActionIn# */ {
|
|
2187
|
-
_updateTime: function (time) {
|
|
2188
|
-
return time * time * time * time * time;
|
|
2189
|
-
},
|
|
2190
|
-
/**
|
|
2191
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2192
|
-
*
|
|
2193
|
-
* @param {Number} dt
|
|
2194
|
-
*/
|
|
2195
|
-
update: function (dt) {
|
|
2196
|
-
this._inner.update(this._updateTime(dt));
|
|
2197
|
-
},
|
|
2198
|
-
/**
|
|
2199
|
-
* to copy object with deep copy.
|
|
2200
|
-
* returns a clone of action.
|
|
2201
|
-
*
|
|
2202
|
-
* @returns {EaseQuinticActionIn}
|
|
2203
|
-
*/
|
|
2204
|
-
clone: function () {
|
|
2205
|
-
var action = new EaseQuinticActionIn();
|
|
2206
|
-
action.initWithAction(this._inner.clone());
|
|
2207
|
-
return action;
|
|
2208
|
-
},
|
|
2209
|
-
/**
|
|
2210
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2211
|
-
* @return {EaseQuinticActionIn}
|
|
2212
|
-
*/
|
|
2213
|
-
reverse: function () {
|
|
2214
|
-
return new EaseQuinticActionIn(this._inner.reverse());
|
|
2215
|
-
}
|
|
2216
|
-
});
|
|
2217
|
-
export const _easeQuinticActionIn = {
|
|
2218
|
-
easing: EaseQuinticActionIn.prototype._updateTime,
|
|
2219
|
-
reverse: function () {
|
|
2220
|
-
return _easeQuinticActionIn;
|
|
2221
|
-
}
|
|
2222
|
-
};
|
|
2223
|
-
/**
|
|
2224
|
-
* Creates the action easing object. <br />
|
|
2225
|
-
* Reference easeInQuint: <br />
|
|
2226
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2227
|
-
* @function
|
|
2228
|
-
* @returns {Object}
|
|
2229
|
-
* @example
|
|
2230
|
-
* //example
|
|
2231
|
-
* action.easing(easeQuinticActionIn());
|
|
2232
|
-
*/
|
|
2233
|
-
export const easeQuinticActionIn = function () {
|
|
2234
|
-
return _easeQuinticActionIn;
|
|
2235
|
-
};
|
|
2236
|
-
/**
|
|
2237
|
-
* EaseQuinticActionOut action. <br />
|
|
2238
|
-
* Reference easeQuint: <br />
|
|
2239
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2240
|
-
* @class
|
|
2241
|
-
* @extends ActionEase
|
|
2242
|
-
*
|
|
2243
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuadraticActionOut());
|
|
2244
|
-
*
|
|
2245
|
-
* @example
|
|
2246
|
-
* //The old usage
|
|
2247
|
-
* EaseQuinticActionOut.create(action);
|
|
2248
|
-
* //The new usage
|
|
2249
|
-
* action.easing(easeQuadraticActionOut());
|
|
2250
|
-
*/
|
|
2251
|
-
export const EaseQuinticActionOut = ActionEase.extend(/** @lends EaseQuinticActionOut# */ {
|
|
2252
|
-
_updateTime: function (time) {
|
|
2253
|
-
time -= 1;
|
|
2254
|
-
return (time * time * time * time * time + 1);
|
|
2255
|
-
},
|
|
2256
|
-
/**
|
|
2257
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2258
|
-
*
|
|
2259
|
-
* @param {Number} dt
|
|
2260
|
-
*/
|
|
2261
|
-
update: function (dt) {
|
|
2262
|
-
this._inner.update(this._updateTime(dt));
|
|
2263
|
-
},
|
|
2264
|
-
/**
|
|
2265
|
-
* to copy object with deep copy.
|
|
2266
|
-
* returns a clone of action.
|
|
2267
|
-
*
|
|
2268
|
-
* @returns {EaseQuinticActionOut}
|
|
2269
|
-
*/
|
|
2270
|
-
clone: function () {
|
|
2271
|
-
var action = new EaseQuinticActionOut();
|
|
2272
|
-
action.initWithAction(this._inner.clone());
|
|
2273
|
-
return action;
|
|
2274
|
-
},
|
|
2275
|
-
/**
|
|
2276
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2277
|
-
* @return {EaseQuinticActionOut}
|
|
2278
|
-
*/
|
|
2279
|
-
reverse: function () {
|
|
2280
|
-
return new EaseQuinticActionOut(this._inner.reverse());
|
|
2281
|
-
}
|
|
2282
|
-
});
|
|
2283
|
-
export const _easeQuinticActionOut = {
|
|
2284
|
-
easing: EaseQuinticActionOut.prototype._updateTime,
|
|
2285
|
-
reverse: function () {
|
|
2286
|
-
return _easeQuinticActionOut;
|
|
2287
|
-
}
|
|
2288
|
-
};
|
|
2289
|
-
/**
|
|
2290
|
-
* Creates the action easing object. <br />
|
|
2291
|
-
* Reference easeOutQuint: <br />
|
|
2292
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2293
|
-
* @function
|
|
2294
|
-
* @returns {Object}
|
|
2295
|
-
* @example
|
|
2296
|
-
* //example
|
|
2297
|
-
* action.easing(easeQuadraticActionOut());
|
|
2298
|
-
*/
|
|
2299
|
-
export const easeQuinticActionOut = function () {
|
|
2300
|
-
return _easeQuinticActionOut;
|
|
2301
|
-
};
|
|
2302
|
-
/**
|
|
2303
|
-
* EaseQuinticActionInOut action. <br />
|
|
2304
|
-
* Reference easeInOutQuint: <br />
|
|
2305
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2306
|
-
* @class
|
|
2307
|
-
* @extends ActionEase
|
|
2308
|
-
*
|
|
2309
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeQuinticActionInOut());
|
|
2310
|
-
*
|
|
2311
|
-
* @example
|
|
2312
|
-
* //The old usage
|
|
2313
|
-
* EaseQuinticActionInOut.create(action);
|
|
2314
|
-
* //The new usage
|
|
2315
|
-
* action.easing(easeQuinticActionInOut());
|
|
2316
|
-
*/
|
|
2317
|
-
export const EaseQuinticActionInOut = ActionEase.extend(/** @lends EaseQuinticActionInOut# */ {
|
|
2318
|
-
_updateTime: function (time) {
|
|
2319
|
-
time = time * 2;
|
|
2320
|
-
if (time < 1)
|
|
2321
|
-
return 0.5 * time * time * time * time * time;
|
|
2322
|
-
time -= 2;
|
|
2323
|
-
return 0.5 * (time * time * time * time * time + 2);
|
|
2324
|
-
},
|
|
2325
|
-
/**
|
|
2326
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2327
|
-
*
|
|
2328
|
-
* @param {Number} dt
|
|
2329
|
-
*/
|
|
2330
|
-
update: function (dt) {
|
|
2331
|
-
this._inner.update(this._updateTime(dt));
|
|
2332
|
-
},
|
|
2333
|
-
/**
|
|
2334
|
-
* to copy object with deep copy.
|
|
2335
|
-
* returns a clone of action.
|
|
2336
|
-
*
|
|
2337
|
-
* @returns {EaseQuinticActionInOut}
|
|
2338
|
-
*/
|
|
2339
|
-
clone: function () {
|
|
2340
|
-
var action = new EaseQuinticActionInOut();
|
|
2341
|
-
action.initWithAction(this._inner.clone());
|
|
2342
|
-
return action;
|
|
2343
|
-
},
|
|
2344
|
-
/**
|
|
2345
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2346
|
-
* @return {EaseQuinticActionInOut}
|
|
2347
|
-
*/
|
|
2348
|
-
reverse: function () {
|
|
2349
|
-
return new EaseQuinticActionInOut(this._inner.reverse());
|
|
2350
|
-
}
|
|
2351
|
-
});
|
|
2352
|
-
export const _easeQuinticActionInOut = {
|
|
2353
|
-
easing: EaseQuinticActionInOut.prototype._updateTime,
|
|
2354
|
-
reverse: function () {
|
|
2355
|
-
return _easeQuinticActionInOut;
|
|
2356
|
-
}
|
|
2357
|
-
};
|
|
2358
|
-
/**
|
|
2359
|
-
* Creates the action easing object. <br />
|
|
2360
|
-
* Reference easeInOutQuint: <br />
|
|
2361
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2362
|
-
* @function
|
|
2363
|
-
* @returns {Object}
|
|
2364
|
-
* @example
|
|
2365
|
-
* //example
|
|
2366
|
-
* action.easing(easeQuinticActionInOut());
|
|
2367
|
-
*/
|
|
2368
|
-
export const easeQuinticActionInOut = function () {
|
|
2369
|
-
return _easeQuinticActionInOut;
|
|
2370
|
-
};
|
|
2371
|
-
/**
|
|
2372
|
-
* EaseCircleActionIn action. <br />
|
|
2373
|
-
* Reference easeInCirc: <br />
|
|
2374
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2375
|
-
* @class
|
|
2376
|
-
* @extends ActionEase
|
|
2377
|
-
*
|
|
2378
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeCircleActionIn());
|
|
2379
|
-
*
|
|
2380
|
-
* @example
|
|
2381
|
-
* //The old usage
|
|
2382
|
-
* EaseCircleActionIn.create(action);
|
|
2383
|
-
* //The new usage
|
|
2384
|
-
* action.easing(easeCircleActionIn());
|
|
2385
|
-
*/
|
|
2386
|
-
export const EaseCircleActionIn = ActionEase.extend(/** @lends EaseCircleActionIn# */ {
|
|
2387
|
-
_updateTime: function (time) {
|
|
2388
|
-
return -1 * (Math.sqrt(1 - time * time) - 1);
|
|
2389
|
-
},
|
|
2390
|
-
/**
|
|
2391
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2392
|
-
*
|
|
2393
|
-
* @param {Number} dt
|
|
2394
|
-
*/
|
|
2395
|
-
update: function (dt) {
|
|
2396
|
-
this._inner.update(this._updateTime(dt));
|
|
2397
|
-
},
|
|
2398
|
-
/**
|
|
2399
|
-
* to copy object with deep copy.
|
|
2400
|
-
* returns a clone of action.
|
|
2401
|
-
*
|
|
2402
|
-
* @returns {EaseCircleActionIn}
|
|
2403
|
-
*/
|
|
2404
|
-
clone: function () {
|
|
2405
|
-
var action = new EaseCircleActionIn();
|
|
2406
|
-
action.initWithAction(this._inner.clone());
|
|
2407
|
-
return action;
|
|
2408
|
-
},
|
|
2409
|
-
/**
|
|
2410
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2411
|
-
* @return {EaseCircleActionIn}
|
|
2412
|
-
*/
|
|
2413
|
-
reverse: function () {
|
|
2414
|
-
return new EaseCircleActionIn(this._inner.reverse());
|
|
2415
|
-
}
|
|
2416
|
-
});
|
|
2417
|
-
export const _easeCircleActionIn = {
|
|
2418
|
-
easing: EaseCircleActionIn.prototype._updateTime,
|
|
2419
|
-
reverse: function () {
|
|
2420
|
-
return _easeCircleActionIn;
|
|
2421
|
-
}
|
|
2422
|
-
};
|
|
2423
|
-
/**
|
|
2424
|
-
* Creates the action easing object. <br />
|
|
2425
|
-
* Reference easeInCirc: <br />
|
|
2426
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2427
|
-
* @function
|
|
2428
|
-
* @returns {Object}
|
|
2429
|
-
* @example
|
|
2430
|
-
* //example
|
|
2431
|
-
* action.easing(easeCircleActionIn());
|
|
2432
|
-
*/
|
|
2433
|
-
export const easeCircleActionIn = function () {
|
|
2434
|
-
return _easeCircleActionIn;
|
|
2435
|
-
};
|
|
2436
|
-
/**
|
|
2437
|
-
* EaseCircleActionOut action. <br />
|
|
2438
|
-
* Reference easeOutCirc: <br />
|
|
2439
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2440
|
-
* @class
|
|
2441
|
-
* @extends ActionEase
|
|
2442
|
-
*
|
|
2443
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeCircleActionOut());
|
|
2444
|
-
*
|
|
2445
|
-
* @example
|
|
2446
|
-
* //The old usage
|
|
2447
|
-
* EaseCircleActionOut.create(action);
|
|
2448
|
-
* //The new usage
|
|
2449
|
-
* action.easing(easeCircleActionOut());
|
|
2450
|
-
*/
|
|
2451
|
-
export const EaseCircleActionOut = ActionEase.extend(/** @lends EaseCircleActionOut# */ {
|
|
2452
|
-
_updateTime: function (time) {
|
|
2453
|
-
time = time - 1;
|
|
2454
|
-
return Math.sqrt(1 - time * time);
|
|
2455
|
-
},
|
|
2456
|
-
/**
|
|
2457
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2458
|
-
*
|
|
2459
|
-
* @param {Number} dt
|
|
2460
|
-
*/
|
|
2461
|
-
update: function (dt) {
|
|
2462
|
-
this._inner.update(this._updateTime(dt));
|
|
2463
|
-
},
|
|
2464
|
-
/**
|
|
2465
|
-
* to copy object with deep copy.
|
|
2466
|
-
* returns a clone of action.
|
|
2467
|
-
*
|
|
2468
|
-
* @returns {EaseCircleActionOut}
|
|
2469
|
-
*/
|
|
2470
|
-
clone: function () {
|
|
2471
|
-
var action = new EaseCircleActionOut();
|
|
2472
|
-
action.initWithAction(this._inner.clone());
|
|
2473
|
-
return action;
|
|
2474
|
-
},
|
|
2475
|
-
/**
|
|
2476
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2477
|
-
* @return {EaseCircleActionOut}
|
|
2478
|
-
*/
|
|
2479
|
-
reverse: function () {
|
|
2480
|
-
return new EaseCircleActionOut(this._inner.reverse());
|
|
2481
|
-
}
|
|
2482
|
-
});
|
|
2483
|
-
export const _easeCircleActionOut = {
|
|
2484
|
-
easing: EaseCircleActionOut.prototype._updateTime,
|
|
2485
|
-
reverse: function () {
|
|
2486
|
-
return _easeCircleActionOut;
|
|
2487
|
-
}
|
|
2488
|
-
};
|
|
2489
|
-
/**
|
|
2490
|
-
* Creates the action easing object. <br />
|
|
2491
|
-
* Reference easeOutCirc: <br />
|
|
2492
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2493
|
-
* @function
|
|
2494
|
-
* @returns {Object}
|
|
2495
|
-
* @exampple
|
|
2496
|
-
* //example
|
|
2497
|
-
* actioneasing(easeCircleActionOut());
|
|
2498
|
-
*/
|
|
2499
|
-
export const easeCircleActionOut = function () {
|
|
2500
|
-
return _easeCircleActionOut;
|
|
2501
|
-
};
|
|
2502
|
-
/**
|
|
2503
|
-
* EaseCircleActionInOut action. <br />
|
|
2504
|
-
* Reference easeInOutCirc: <br />
|
|
2505
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2506
|
-
* @class
|
|
2507
|
-
* @extends ActionEase
|
|
2508
|
-
*
|
|
2509
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeCircleActionInOut());
|
|
2510
|
-
*
|
|
2511
|
-
* @example
|
|
2512
|
-
* //The old usage
|
|
2513
|
-
* EaseCircleActionInOut.create(action);
|
|
2514
|
-
* //The new usage
|
|
2515
|
-
* action.easing(easeCircleActionInOut());
|
|
2516
|
-
*/
|
|
2517
|
-
export const EaseCircleActionInOut = ActionEase.extend(/** @lends EaseCircleActionInOut# */ {
|
|
2518
|
-
_updateTime: function (time) {
|
|
2519
|
-
time = time * 2;
|
|
2520
|
-
if (time < 1)
|
|
2521
|
-
return -0.5 * (Math.sqrt(1 - time * time) - 1);
|
|
2522
|
-
time -= 2;
|
|
2523
|
-
return 0.5 * (Math.sqrt(1 - time * time) + 1);
|
|
2524
|
-
},
|
|
2525
|
-
/**
|
|
2526
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2527
|
-
*
|
|
2528
|
-
* @param {Number} dt
|
|
2529
|
-
*/
|
|
2530
|
-
update: function (dt) {
|
|
2531
|
-
this._inner.update(this._updateTime(dt));
|
|
2532
|
-
},
|
|
2533
|
-
/**
|
|
2534
|
-
* to copy object with deep copy.
|
|
2535
|
-
* returns a clone of action.
|
|
2536
|
-
*
|
|
2537
|
-
* @returns {EaseCircleActionInOut}
|
|
2538
|
-
*/
|
|
2539
|
-
clone: function () {
|
|
2540
|
-
var action = new EaseCircleActionInOut();
|
|
2541
|
-
action.initWithAction(this._inner.clone());
|
|
2542
|
-
return action;
|
|
2543
|
-
},
|
|
2544
|
-
/**
|
|
2545
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2546
|
-
* @return {EaseCircleActionInOut}
|
|
2547
|
-
*/
|
|
2548
|
-
reverse: function () {
|
|
2549
|
-
return new EaseCircleActionInOut(this._inner.reverse());
|
|
2550
|
-
}
|
|
2551
|
-
});
|
|
2552
|
-
export const _easeCircleActionInOut = {
|
|
2553
|
-
easing: EaseCircleActionInOut.prototype._updateTime,
|
|
2554
|
-
reverse: function () {
|
|
2555
|
-
return _easeCircleActionInOut;
|
|
2556
|
-
}
|
|
2557
|
-
};
|
|
2558
|
-
/**
|
|
2559
|
-
* Creates the action easing object. <br />
|
|
2560
|
-
* Reference easeInOutCirc: <br />
|
|
2561
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2562
|
-
* @function
|
|
2563
|
-
* @returns {Object}
|
|
2564
|
-
* @example
|
|
2565
|
-
* //example
|
|
2566
|
-
* action.easing(easeCircleActionInOut());
|
|
2567
|
-
*/
|
|
2568
|
-
export const easeCircleActionInOut = function () {
|
|
2569
|
-
return _easeCircleActionInOut;
|
|
2570
|
-
};
|
|
2571
|
-
/**
|
|
2572
|
-
* EaseCubicActionIn action. <br />
|
|
2573
|
-
* Reference easeInCubic: <br />
|
|
2574
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2575
|
-
* @class
|
|
2576
|
-
* @extends ActionEase
|
|
2577
|
-
*
|
|
2578
|
-
* @deprecated since v3.0 <br /> action.easing(easeCubicActionIn());
|
|
2579
|
-
*
|
|
2580
|
-
* @example
|
|
2581
|
-
* //The old usage
|
|
2582
|
-
* EaseCubicActionIn.create(action);
|
|
2583
|
-
* //The new usage
|
|
2584
|
-
* action.easing(easeCubicActionIn());
|
|
2585
|
-
*/
|
|
2586
|
-
export const EaseCubicActionIn = ActionEase.extend(/** @lends EaseCubicActionIn# */ {
|
|
2587
|
-
_updateTime: function (time) {
|
|
2588
|
-
return time * time * time;
|
|
2589
|
-
},
|
|
2590
|
-
/**
|
|
2591
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2592
|
-
*
|
|
2593
|
-
* @param {Number} dt
|
|
2594
|
-
*/
|
|
2595
|
-
update: function (dt) {
|
|
2596
|
-
this._inner.update(this._updateTime(dt));
|
|
2597
|
-
},
|
|
2598
|
-
/**
|
|
2599
|
-
* to copy object with deep copy.
|
|
2600
|
-
* returns a clone of action.
|
|
2601
|
-
*
|
|
2602
|
-
* @returns {EaseCubicActionIn}
|
|
2603
|
-
*/
|
|
2604
|
-
clone: function () {
|
|
2605
|
-
var action = new EaseCubicActionIn();
|
|
2606
|
-
action.initWithAction(this._inner.clone());
|
|
2607
|
-
return action;
|
|
2608
|
-
},
|
|
2609
|
-
/**
|
|
2610
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2611
|
-
* @return {EaseCubicActionIn}
|
|
2612
|
-
*/
|
|
2613
|
-
reverse: function () {
|
|
2614
|
-
return new EaseCubicActionIn(this._inner.reverse());
|
|
2615
|
-
}
|
|
2616
|
-
});
|
|
2617
|
-
export const _easeCubicActionIn = {
|
|
2618
|
-
easing: EaseCubicActionIn.prototype._updateTime,
|
|
2619
|
-
reverse: function () {
|
|
2620
|
-
return _easeCubicActionIn;
|
|
2621
|
-
}
|
|
2622
|
-
};
|
|
2623
|
-
/**
|
|
2624
|
-
* Creates the action easing object. <br />
|
|
2625
|
-
* Reference easeInCubic: <br />
|
|
2626
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2627
|
-
* @function
|
|
2628
|
-
* @returns {Object}
|
|
2629
|
-
* @example
|
|
2630
|
-
* //example
|
|
2631
|
-
* action.easing(easeCubicActionIn());
|
|
2632
|
-
*/
|
|
2633
|
-
export const easeCubicActionIn = function () {
|
|
2634
|
-
return _easeCubicActionIn;
|
|
2635
|
-
};
|
|
2636
|
-
/**
|
|
2637
|
-
* EaseCubicActionOut action. <br />
|
|
2638
|
-
* Reference easeOutCubic: <br />
|
|
2639
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2640
|
-
* @class
|
|
2641
|
-
* @extends ActionEase
|
|
2642
|
-
*
|
|
2643
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeCubicActionOut());
|
|
2644
|
-
*
|
|
2645
|
-
* @example
|
|
2646
|
-
* //The old usage
|
|
2647
|
-
* EaseCubicActionOut.create(action);
|
|
2648
|
-
* //The new usage
|
|
2649
|
-
* action.easing(easeCubicActionOut());
|
|
2650
|
-
*/
|
|
2651
|
-
export const EaseCubicActionOut = ActionEase.extend(/** @lends EaseCubicActionOut# */ {
|
|
2652
|
-
_updateTime: function (time) {
|
|
2653
|
-
time -= 1;
|
|
2654
|
-
return (time * time * time + 1);
|
|
2655
|
-
},
|
|
2656
|
-
/**
|
|
2657
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2658
|
-
*
|
|
2659
|
-
* @param {Number} dt
|
|
2660
|
-
*/
|
|
2661
|
-
update: function (dt) {
|
|
2662
|
-
this._inner.update(this._updateTime(dt));
|
|
2663
|
-
},
|
|
2664
|
-
/**
|
|
2665
|
-
* to copy object with deep copy.
|
|
2666
|
-
* returns a clone of action.
|
|
2667
|
-
*
|
|
2668
|
-
* @returns {EaseCubicActionOut}
|
|
2669
|
-
*/
|
|
2670
|
-
clone: function () {
|
|
2671
|
-
var action = new EaseCubicActionOut();
|
|
2672
|
-
action.initWithAction(this._inner.clone());
|
|
2673
|
-
return action;
|
|
2674
|
-
},
|
|
2675
|
-
/**
|
|
2676
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2677
|
-
* @return {EaseCubicActionOut}
|
|
2678
|
-
*/
|
|
2679
|
-
reverse: function () {
|
|
2680
|
-
return new EaseCubicActionOut(this._inner.reverse());
|
|
2681
|
-
}
|
|
2682
|
-
});
|
|
2683
|
-
export const _easeCubicActionOut = {
|
|
2684
|
-
easing: EaseCubicActionOut.prototype._updateTime,
|
|
2685
|
-
reverse: function () {
|
|
2686
|
-
return _easeCubicActionOut;
|
|
2687
|
-
}
|
|
2688
|
-
};
|
|
2689
|
-
/**
|
|
2690
|
-
* Creates the action easing object. <br />
|
|
2691
|
-
* Reference easeOutCubic: <br />
|
|
2692
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2693
|
-
* @function
|
|
2694
|
-
* @returns {Object}
|
|
2695
|
-
* @example
|
|
2696
|
-
* //example
|
|
2697
|
-
* action.easing(easeCubicActionOut());
|
|
2698
|
-
*/
|
|
2699
|
-
export const easeCubicActionOut = function () {
|
|
2700
|
-
return _easeCubicActionOut;
|
|
2701
|
-
};
|
|
2702
|
-
/**
|
|
2703
|
-
* EaseCubicActionInOut action. <br />
|
|
2704
|
-
* Reference easeInOutCubic: <br />
|
|
2705
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2706
|
-
* @class
|
|
2707
|
-
* @extends ActionEase
|
|
2708
|
-
*
|
|
2709
|
-
* @deprecated since v3.0 <br /> Please use action.easing(easeCubicActionInOut());
|
|
2710
|
-
*
|
|
2711
|
-
* @example
|
|
2712
|
-
* //The old usage
|
|
2713
|
-
* EaseCubicActionInOut.create(action);
|
|
2714
|
-
* //The new usage
|
|
2715
|
-
* action.easing(easeCubicActionInOut());
|
|
2716
|
-
*/
|
|
2717
|
-
export const EaseCubicActionInOut = ActionEase.extend(/** @lends EaseCubicActionInOut# */ {
|
|
2718
|
-
_updateTime: function (time) {
|
|
2719
|
-
time = time * 2;
|
|
2720
|
-
if (time < 1)
|
|
2721
|
-
return 0.5 * time * time * time;
|
|
2722
|
-
time -= 2;
|
|
2723
|
-
return 0.5 * (time * time * time + 2);
|
|
2724
|
-
},
|
|
2725
|
-
/**
|
|
2726
|
-
* Called once per frame. Time is the number of seconds of a frame interval.
|
|
2727
|
-
*
|
|
2728
|
-
* @param {Number} dt
|
|
2729
|
-
*/
|
|
2730
|
-
update: function (dt) {
|
|
2731
|
-
this._inner.update(this._updateTime(dt));
|
|
2732
|
-
},
|
|
2733
|
-
/**
|
|
2734
|
-
* to copy object with deep copy.
|
|
2735
|
-
* returns a clone of action.
|
|
2736
|
-
*
|
|
2737
|
-
* @returns {EaseCubicActionInOut}
|
|
2738
|
-
*/
|
|
2739
|
-
clone: function () {
|
|
2740
|
-
var action = new EaseCubicActionInOut();
|
|
2741
|
-
action.initWithAction(this._inner.clone());
|
|
2742
|
-
return action;
|
|
2743
|
-
},
|
|
2744
|
-
/**
|
|
2745
|
-
* Create a action. Opposite with the original motion trajectory.
|
|
2746
|
-
* @return {EaseCubicActionInOut}
|
|
2747
|
-
*/
|
|
2748
|
-
reverse: function () {
|
|
2749
|
-
return new EaseCubicActionInOut(this._inner.reverse());
|
|
2750
|
-
}
|
|
2751
|
-
});
|
|
2752
|
-
export const _easeCubicActionInOut = {
|
|
2753
|
-
easing: EaseCubicActionInOut.prototype._updateTime,
|
|
2754
|
-
reverse: function () {
|
|
2755
|
-
return _easeCubicActionInOut;
|
|
2756
|
-
}
|
|
2757
|
-
};
|
|
2758
|
-
/**
|
|
2759
|
-
* Creates the action easing object. <br />
|
|
2760
|
-
* Reference easeInOutCubic: <br />
|
|
2761
|
-
* {@link http://www.zhihu.com/question/21981571/answer/19925418}
|
|
2762
|
-
* @function
|
|
2763
|
-
* @returns {Object}
|
|
2764
|
-
*/
|
|
2765
|
-
export const easeCubicActionInOut = function () {
|
|
2766
|
-
return _easeCubicActionInOut;
|
|
2767
|
-
};
|