konva 10.0.10 → 10.0.11

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.
Files changed (127) hide show
  1. package/konva.js +2 -2
  2. package/konva.min.js +2 -2
  3. package/lib/Animation.d.ts +24 -0
  4. package/lib/Animation.js +142 -0
  5. package/lib/BezierFunctions.d.ts +6 -0
  6. package/lib/BezierFunctions.js +784 -0
  7. package/lib/Canvas.d.ts +33 -0
  8. package/lib/Canvas.js +107 -0
  9. package/lib/Container.d.ts +54 -0
  10. package/lib/Container.js +316 -0
  11. package/lib/Context.d.ts +95 -0
  12. package/lib/Context.js +561 -0
  13. package/lib/Core.d.ts +3 -0
  14. package/lib/Core.js +3 -0
  15. package/lib/DragAndDrop.d.ts +17 -0
  16. package/lib/DragAndDrop.js +110 -0
  17. package/lib/Factory.d.ts +22 -0
  18. package/lib/Factory.js +123 -0
  19. package/lib/FastLayer.d.ts +4 -0
  20. package/lib/FastLayer.js +12 -0
  21. package/lib/Global.d.ts +37 -0
  22. package/lib/Global.js +66 -0
  23. package/lib/Group.d.ts +9 -0
  24. package/lib/Group.js +13 -0
  25. package/lib/Layer.d.ts +62 -0
  26. package/lib/Layer.js +305 -0
  27. package/lib/Node.d.ts +323 -0
  28. package/lib/Node.js +1532 -0
  29. package/lib/PointerEvents.d.ts +11 -0
  30. package/lib/PointerEvents.js +37 -0
  31. package/lib/Shape.d.ts +196 -0
  32. package/lib/Shape.js +555 -0
  33. package/lib/Stage.d.ts +86 -0
  34. package/lib/Stage.js +715 -0
  35. package/lib/Tween.d.ts +90 -0
  36. package/lib/Tween.js +531 -0
  37. package/lib/Util.d.ts +137 -0
  38. package/lib/Util.js +909 -0
  39. package/lib/Validators.d.ts +11 -0
  40. package/lib/Validators.js +178 -0
  41. package/lib/_CoreInternals.d.ts +224 -0
  42. package/lib/_CoreInternals.js +34 -0
  43. package/lib/_FullInternals.d.ts +306 -0
  44. package/lib/_FullInternals.js +80 -0
  45. package/lib/canvas-backend.d.ts +2 -0
  46. package/lib/canvas-backend.js +27 -0
  47. package/lib/filters/Blur.d.ts +2 -0
  48. package/lib/filters/Blur.js +235 -0
  49. package/lib/filters/Brighten.d.ts +2 -0
  50. package/lib/filters/Brighten.js +12 -0
  51. package/lib/filters/Brightness.d.ts +2 -0
  52. package/lib/filters/Brightness.js +8 -0
  53. package/lib/filters/Contrast.d.ts +2 -0
  54. package/lib/filters/Contrast.js +35 -0
  55. package/lib/filters/Emboss.d.ts +2 -0
  56. package/lib/filters/Emboss.js +101 -0
  57. package/lib/filters/Enhance.d.ts +2 -0
  58. package/lib/filters/Enhance.js +84 -0
  59. package/lib/filters/Grayscale.d.ts +2 -0
  60. package/lib/filters/Grayscale.js +9 -0
  61. package/lib/filters/HSL.d.ts +2 -0
  62. package/lib/filters/HSL.js +24 -0
  63. package/lib/filters/HSV.d.ts +2 -0
  64. package/lib/filters/HSV.js +23 -0
  65. package/lib/filters/Invert.d.ts +2 -0
  66. package/lib/filters/Invert.js +8 -0
  67. package/lib/filters/Kaleidoscope.d.ts +2 -0
  68. package/lib/filters/Kaleidoscope.js +133 -0
  69. package/lib/filters/Mask.d.ts +2 -0
  70. package/lib/filters/Mask.js +151 -0
  71. package/lib/filters/Noise.d.ts +2 -0
  72. package/lib/filters/Noise.js +12 -0
  73. package/lib/filters/Pixelate.d.ts +2 -0
  74. package/lib/filters/Pixelate.js +60 -0
  75. package/lib/filters/Posterize.d.ts +2 -0
  76. package/lib/filters/Posterize.js +10 -0
  77. package/lib/filters/RGB.d.ts +2 -0
  78. package/lib/filters/RGB.js +38 -0
  79. package/lib/filters/RGBA.d.ts +2 -0
  80. package/lib/filters/RGBA.js +49 -0
  81. package/lib/filters/Sepia.d.ts +2 -0
  82. package/lib/filters/Sepia.js +11 -0
  83. package/lib/filters/Solarize.d.ts +2 -0
  84. package/lib/filters/Solarize.js +14 -0
  85. package/lib/filters/Threshold.d.ts +2 -0
  86. package/lib/filters/Threshold.js +10 -0
  87. package/lib/index.d.ts +2 -0
  88. package/lib/index.js +2 -0
  89. package/lib/shapes/Arc.d.ts +27 -0
  90. package/lib/shapes/Arc.js +60 -0
  91. package/lib/shapes/Arrow.d.ts +27 -0
  92. package/lib/shapes/Arrow.js +99 -0
  93. package/lib/shapes/Circle.d.ts +15 -0
  94. package/lib/shapes/Circle.js +33 -0
  95. package/lib/shapes/Ellipse.d.ts +18 -0
  96. package/lib/shapes/Ellipse.js +37 -0
  97. package/lib/shapes/Image.d.ts +29 -0
  98. package/lib/shapes/Image.js +131 -0
  99. package/lib/shapes/Label.d.ts +39 -0
  100. package/lib/shapes/Label.js +173 -0
  101. package/lib/shapes/Line.d.ts +29 -0
  102. package/lib/shapes/Line.js +156 -0
  103. package/lib/shapes/Path.d.ts +50 -0
  104. package/lib/shapes/Path.js +670 -0
  105. package/lib/shapes/Rect.d.ts +11 -0
  106. package/lib/shapes/Rect.js +22 -0
  107. package/lib/shapes/RegularPolygon.d.ts +26 -0
  108. package/lib/shapes/RegularPolygon.js +72 -0
  109. package/lib/shapes/Ring.d.ts +17 -0
  110. package/lib/shapes/Ring.js +33 -0
  111. package/lib/shapes/Sprite.d.ts +32 -0
  112. package/lib/shapes/Sprite.js +108 -0
  113. package/lib/shapes/Star.d.ts +19 -0
  114. package/lib/shapes/Star.js +38 -0
  115. package/lib/shapes/Text.d.ts +90 -0
  116. package/lib/shapes/Text.js +461 -0
  117. package/lib/shapes/TextPath.d.ts +72 -0
  118. package/lib/shapes/TextPath.js +268 -0
  119. package/lib/shapes/Transformer.d.ts +130 -0
  120. package/lib/shapes/Transformer.js +1009 -0
  121. package/lib/shapes/Wedge.d.ts +19 -0
  122. package/lib/shapes/Wedge.js +38 -0
  123. package/lib/skia-backend.d.ts +2 -0
  124. package/lib/skia-backend.js +24 -0
  125. package/lib/types.d.ts +56 -0
  126. package/lib/types.js +21 -0
  127. package/package.json +1 -1
package/lib/Tween.d.ts ADDED
@@ -0,0 +1,90 @@
1
+ import { Animation } from './Animation.ts';
2
+ import type { NodeConfig } from './Node.ts';
3
+ import { Node } from './Node.ts';
4
+ declare class TweenEngine {
5
+ prop: string;
6
+ propFunc: Function;
7
+ begin: number;
8
+ _pos: number;
9
+ duration: number;
10
+ prevPos: number;
11
+ yoyo: boolean;
12
+ _time: number;
13
+ _position: number;
14
+ _startTime: number;
15
+ _finish: number;
16
+ func: Function;
17
+ _change: number;
18
+ state: number;
19
+ onPlay: Function;
20
+ onReverse: Function;
21
+ onPause: Function;
22
+ onReset: Function;
23
+ onFinish: Function;
24
+ onUpdate: Function;
25
+ constructor(prop: any, propFunc: any, func: any, begin: any, finish: any, duration: any, yoyo: any);
26
+ fire(str: any): void;
27
+ setTime(t: any): void;
28
+ getTime(): number;
29
+ setPosition(p: any): void;
30
+ getPosition(t: any): any;
31
+ play(): void;
32
+ reverse(): void;
33
+ seek(t: any): void;
34
+ reset(): void;
35
+ finish(): void;
36
+ update(): void;
37
+ onEnterFrame(): void;
38
+ pause(): void;
39
+ getTimer(): number;
40
+ }
41
+ export interface TweenConfig extends NodeConfig {
42
+ easing?: typeof Easings[keyof typeof Easings];
43
+ yoyo?: boolean;
44
+ onReset?: Function;
45
+ onFinish?: Function;
46
+ onUpdate?: Function;
47
+ duration?: number;
48
+ node: Node;
49
+ }
50
+ export declare class Tween {
51
+ static attrs: {};
52
+ static tweens: {};
53
+ node: Node;
54
+ anim: Animation;
55
+ tween: TweenEngine;
56
+ _id: number;
57
+ onFinish: Function | undefined;
58
+ onReset: Function | undefined;
59
+ onUpdate: Function | undefined;
60
+ constructor(config: TweenConfig);
61
+ _addAttr(key: any, end: any): void;
62
+ _tweenFunc(i: any): void;
63
+ _addListeners(): void;
64
+ play(): this;
65
+ reverse(): this;
66
+ reset(): this;
67
+ seek(t: any): this;
68
+ pause(): this;
69
+ finish(): this;
70
+ destroy(): void;
71
+ }
72
+ export declare const Easings: {
73
+ BackEaseIn(t: any, b: any, c: any, d: any): any;
74
+ BackEaseOut(t: any, b: any, c: any, d: any): any;
75
+ BackEaseInOut(t: any, b: any, c: any, d: any): any;
76
+ ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
77
+ ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
78
+ ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
79
+ BounceEaseOut(t: any, b: any, c: any, d: any): any;
80
+ BounceEaseIn(t: any, b: any, c: any, d: any): any;
81
+ BounceEaseInOut(t: any, b: any, c: any, d: any): any;
82
+ EaseIn(t: any, b: any, c: any, d: any): any;
83
+ EaseOut(t: any, b: any, c: any, d: any): any;
84
+ EaseInOut(t: any, b: any, c: any, d: any): any;
85
+ StrongEaseIn(t: any, b: any, c: any, d: any): any;
86
+ StrongEaseOut(t: any, b: any, c: any, d: any): any;
87
+ StrongEaseInOut(t: any, b: any, c: any, d: any): any;
88
+ Linear(t: any, b: any, c: any, d: any): any;
89
+ };
90
+ export {};
package/lib/Tween.js ADDED
@@ -0,0 +1,531 @@
1
+ import { Util } from "./Util.js";
2
+ import { Animation } from "./Animation.js";
3
+ import { Node } from "./Node.js";
4
+ import { Konva } from "./Global.js";
5
+ const blacklist = {
6
+ node: 1,
7
+ duration: 1,
8
+ easing: 1,
9
+ onFinish: 1,
10
+ yoyo: 1,
11
+ }, PAUSED = 1, PLAYING = 2, REVERSING = 3, colorAttrs = ['fill', 'stroke', 'shadowColor'];
12
+ let idCounter = 0;
13
+ class TweenEngine {
14
+ constructor(prop, propFunc, func, begin, finish, duration, yoyo) {
15
+ this.prop = prop;
16
+ this.propFunc = propFunc;
17
+ this.begin = begin;
18
+ this._pos = begin;
19
+ this.duration = duration;
20
+ this._change = 0;
21
+ this.prevPos = 0;
22
+ this.yoyo = yoyo;
23
+ this._time = 0;
24
+ this._position = 0;
25
+ this._startTime = 0;
26
+ this._finish = 0;
27
+ this.func = func;
28
+ this._change = finish - this.begin;
29
+ this.pause();
30
+ }
31
+ fire(str) {
32
+ const handler = this[str];
33
+ if (handler) {
34
+ handler();
35
+ }
36
+ }
37
+ setTime(t) {
38
+ if (t > this.duration) {
39
+ if (this.yoyo) {
40
+ this._time = this.duration;
41
+ this.reverse();
42
+ }
43
+ else {
44
+ this.finish();
45
+ }
46
+ }
47
+ else if (t < 0) {
48
+ if (this.yoyo) {
49
+ this._time = 0;
50
+ this.play();
51
+ }
52
+ else {
53
+ this.reset();
54
+ }
55
+ }
56
+ else {
57
+ this._time = t;
58
+ this.update();
59
+ }
60
+ }
61
+ getTime() {
62
+ return this._time;
63
+ }
64
+ setPosition(p) {
65
+ this.prevPos = this._pos;
66
+ this.propFunc(p);
67
+ this._pos = p;
68
+ }
69
+ getPosition(t) {
70
+ if (t === undefined) {
71
+ t = this._time;
72
+ }
73
+ return this.func(t, this.begin, this._change, this.duration);
74
+ }
75
+ play() {
76
+ this.state = PLAYING;
77
+ this._startTime = this.getTimer() - this._time;
78
+ this.onEnterFrame();
79
+ this.fire('onPlay');
80
+ }
81
+ reverse() {
82
+ this.state = REVERSING;
83
+ this._time = this.duration - this._time;
84
+ this._startTime = this.getTimer() - this._time;
85
+ this.onEnterFrame();
86
+ this.fire('onReverse');
87
+ }
88
+ seek(t) {
89
+ this.pause();
90
+ this._time = t;
91
+ this.update();
92
+ this.fire('onSeek');
93
+ }
94
+ reset() {
95
+ this.pause();
96
+ this._time = 0;
97
+ this.update();
98
+ this.fire('onReset');
99
+ }
100
+ finish() {
101
+ this.pause();
102
+ this._time = this.duration;
103
+ this.update();
104
+ this.fire('onFinish');
105
+ }
106
+ update() {
107
+ this.setPosition(this.getPosition(this._time));
108
+ this.fire('onUpdate');
109
+ }
110
+ onEnterFrame() {
111
+ const t = this.getTimer() - this._startTime;
112
+ if (this.state === PLAYING) {
113
+ this.setTime(t);
114
+ }
115
+ else if (this.state === REVERSING) {
116
+ this.setTime(this.duration - t);
117
+ }
118
+ }
119
+ pause() {
120
+ this.state = PAUSED;
121
+ this.fire('onPause');
122
+ }
123
+ getTimer() {
124
+ return new Date().getTime();
125
+ }
126
+ }
127
+ export class Tween {
128
+ constructor(config) {
129
+ const that = this, node = config.node, nodeId = node._id, easing = config.easing || Easings.Linear, yoyo = !!config.yoyo;
130
+ let duration, key;
131
+ if (typeof config.duration === 'undefined') {
132
+ duration = 0.3;
133
+ }
134
+ else if (config.duration === 0) {
135
+ duration = 0.001;
136
+ }
137
+ else {
138
+ duration = config.duration;
139
+ }
140
+ this.node = node;
141
+ this._id = idCounter++;
142
+ const layers = node.getLayer() ||
143
+ (node instanceof Konva['Stage'] ? node.getLayers() : null);
144
+ if (!layers) {
145
+ Util.error('Tween constructor have `node` that is not in a layer. Please add node into layer first.');
146
+ }
147
+ this.anim = new Animation(function () {
148
+ that.tween.onEnterFrame();
149
+ }, layers);
150
+ this.tween = new TweenEngine(key, function (i) {
151
+ that._tweenFunc(i);
152
+ }, easing, 0, 1, duration * 1000, yoyo);
153
+ this._addListeners();
154
+ if (!Tween.attrs[nodeId]) {
155
+ Tween.attrs[nodeId] = {};
156
+ }
157
+ if (!Tween.attrs[nodeId][this._id]) {
158
+ Tween.attrs[nodeId][this._id] = {};
159
+ }
160
+ if (!Tween.tweens[nodeId]) {
161
+ Tween.tweens[nodeId] = {};
162
+ }
163
+ for (key in config) {
164
+ if (blacklist[key] === undefined) {
165
+ this._addAttr(key, config[key]);
166
+ }
167
+ }
168
+ this.reset();
169
+ this.onFinish = config.onFinish;
170
+ this.onReset = config.onReset;
171
+ this.onUpdate = config.onUpdate;
172
+ }
173
+ _addAttr(key, end) {
174
+ const node = this.node, nodeId = node._id;
175
+ let diff, len, trueEnd, trueStart, endRGBA;
176
+ const tweenId = Tween.tweens[nodeId][key];
177
+ if (tweenId) {
178
+ delete Tween.attrs[nodeId][tweenId][key];
179
+ }
180
+ let start = node.getAttr(key);
181
+ if (Util._isArray(end)) {
182
+ diff = [];
183
+ len = Math.max(end.length, start.length);
184
+ if (key === 'points' && end.length !== start.length) {
185
+ if (end.length > start.length) {
186
+ trueStart = start;
187
+ start = Util._prepareArrayForTween(start, end, node.closed());
188
+ }
189
+ else {
190
+ trueEnd = end;
191
+ end = Util._prepareArrayForTween(end, start, node.closed());
192
+ }
193
+ }
194
+ if (key.indexOf('fill') === 0) {
195
+ for (let n = 0; n < len; n++) {
196
+ if (n % 2 === 0) {
197
+ diff.push(end[n] - start[n]);
198
+ }
199
+ else {
200
+ const startRGBA = Util.colorToRGBA(start[n]);
201
+ endRGBA = Util.colorToRGBA(end[n]);
202
+ start[n] = startRGBA;
203
+ diff.push({
204
+ r: endRGBA.r - startRGBA.r,
205
+ g: endRGBA.g - startRGBA.g,
206
+ b: endRGBA.b - startRGBA.b,
207
+ a: endRGBA.a - startRGBA.a,
208
+ });
209
+ }
210
+ }
211
+ }
212
+ else {
213
+ for (let n = 0; n < len; n++) {
214
+ diff.push(end[n] - start[n]);
215
+ }
216
+ }
217
+ }
218
+ else if (colorAttrs.indexOf(key) !== -1) {
219
+ start = Util.colorToRGBA(start);
220
+ endRGBA = Util.colorToRGBA(end);
221
+ diff = {
222
+ r: endRGBA.r - start.r,
223
+ g: endRGBA.g - start.g,
224
+ b: endRGBA.b - start.b,
225
+ a: endRGBA.a - start.a,
226
+ };
227
+ }
228
+ else {
229
+ diff = end - start;
230
+ }
231
+ Tween.attrs[nodeId][this._id][key] = {
232
+ start: start,
233
+ diff: diff,
234
+ end: end,
235
+ trueEnd: trueEnd,
236
+ trueStart: trueStart,
237
+ };
238
+ Tween.tweens[nodeId][key] = this._id;
239
+ }
240
+ _tweenFunc(i) {
241
+ const node = this.node, attrs = Tween.attrs[node._id][this._id];
242
+ let key, attr, start, diff, newVal, n, len, end;
243
+ for (key in attrs) {
244
+ attr = attrs[key];
245
+ start = attr.start;
246
+ diff = attr.diff;
247
+ end = attr.end;
248
+ if (Util._isArray(start)) {
249
+ newVal = [];
250
+ len = Math.max(start.length, end.length);
251
+ if (key.indexOf('fill') === 0) {
252
+ for (n = 0; n < len; n++) {
253
+ if (n % 2 === 0) {
254
+ newVal.push((start[n] || 0) + diff[n] * i);
255
+ }
256
+ else {
257
+ newVal.push('rgba(' +
258
+ Math.round(start[n].r + diff[n].r * i) +
259
+ ',' +
260
+ Math.round(start[n].g + diff[n].g * i) +
261
+ ',' +
262
+ Math.round(start[n].b + diff[n].b * i) +
263
+ ',' +
264
+ (start[n].a + diff[n].a * i) +
265
+ ')');
266
+ }
267
+ }
268
+ }
269
+ else {
270
+ for (n = 0; n < len; n++) {
271
+ newVal.push((start[n] || 0) + diff[n] * i);
272
+ }
273
+ }
274
+ }
275
+ else if (colorAttrs.indexOf(key) !== -1) {
276
+ newVal =
277
+ 'rgba(' +
278
+ Math.round(start.r + diff.r * i) +
279
+ ',' +
280
+ Math.round(start.g + diff.g * i) +
281
+ ',' +
282
+ Math.round(start.b + diff.b * i) +
283
+ ',' +
284
+ (start.a + diff.a * i) +
285
+ ')';
286
+ }
287
+ else {
288
+ newVal = start + diff * i;
289
+ }
290
+ node.setAttr(key, newVal);
291
+ }
292
+ }
293
+ _addListeners() {
294
+ this.tween.onPlay = () => {
295
+ this.anim.start();
296
+ };
297
+ this.tween.onReverse = () => {
298
+ this.anim.start();
299
+ };
300
+ this.tween.onPause = () => {
301
+ this.anim.stop();
302
+ };
303
+ this.tween.onFinish = () => {
304
+ const node = this.node;
305
+ const attrs = Tween.attrs[node._id][this._id];
306
+ if (attrs.points && attrs.points.trueEnd) {
307
+ node.setAttr('points', attrs.points.trueEnd);
308
+ }
309
+ if (this.onFinish) {
310
+ this.onFinish.call(this);
311
+ }
312
+ };
313
+ this.tween.onReset = () => {
314
+ const node = this.node;
315
+ const attrs = Tween.attrs[node._id][this._id];
316
+ if (attrs.points && attrs.points.trueStart) {
317
+ node.points(attrs.points.trueStart);
318
+ }
319
+ if (this.onReset) {
320
+ this.onReset();
321
+ }
322
+ };
323
+ this.tween.onUpdate = () => {
324
+ if (this.onUpdate) {
325
+ this.onUpdate.call(this);
326
+ }
327
+ };
328
+ }
329
+ play() {
330
+ this.tween.play();
331
+ return this;
332
+ }
333
+ reverse() {
334
+ this.tween.reverse();
335
+ return this;
336
+ }
337
+ reset() {
338
+ this.tween.reset();
339
+ return this;
340
+ }
341
+ seek(t) {
342
+ this.tween.seek(t * 1000);
343
+ return this;
344
+ }
345
+ pause() {
346
+ this.tween.pause();
347
+ return this;
348
+ }
349
+ finish() {
350
+ this.tween.finish();
351
+ return this;
352
+ }
353
+ destroy() {
354
+ const nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId];
355
+ this.pause();
356
+ if (this.anim) {
357
+ this.anim.stop();
358
+ }
359
+ for (const key in attrs) {
360
+ delete Tween.tweens[nodeId][key];
361
+ }
362
+ delete Tween.attrs[nodeId][thisId];
363
+ if (Tween.tweens[nodeId]) {
364
+ if (Object.keys(Tween.tweens[nodeId]).length === 0) {
365
+ delete Tween.tweens[nodeId];
366
+ }
367
+ if (Object.keys(Tween.attrs[nodeId]).length === 0) {
368
+ delete Tween.attrs[nodeId];
369
+ }
370
+ }
371
+ }
372
+ }
373
+ Tween.attrs = {};
374
+ Tween.tweens = {};
375
+ Node.prototype.to = function (params) {
376
+ const onFinish = params.onFinish;
377
+ params.node = this;
378
+ params.onFinish = function () {
379
+ this.destroy();
380
+ if (onFinish) {
381
+ onFinish();
382
+ }
383
+ };
384
+ const tween = new Tween(params);
385
+ tween.play();
386
+ };
387
+ export const Easings = {
388
+ BackEaseIn(t, b, c, d) {
389
+ const s = 1.70158;
390
+ return c * (t /= d) * t * ((s + 1) * t - s) + b;
391
+ },
392
+ BackEaseOut(t, b, c, d) {
393
+ const s = 1.70158;
394
+ return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
395
+ },
396
+ BackEaseInOut(t, b, c, d) {
397
+ let s = 1.70158;
398
+ if ((t /= d / 2) < 1) {
399
+ return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
400
+ }
401
+ return (c / 2) * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
402
+ },
403
+ ElasticEaseIn(t, b, c, d, a, p) {
404
+ let s = 0;
405
+ if (t === 0) {
406
+ return b;
407
+ }
408
+ if ((t /= d) === 1) {
409
+ return b + c;
410
+ }
411
+ if (!p) {
412
+ p = d * 0.3;
413
+ }
414
+ if (!a || a < Math.abs(c)) {
415
+ a = c;
416
+ s = p / 4;
417
+ }
418
+ else {
419
+ s = (p / (2 * Math.PI)) * Math.asin(c / a);
420
+ }
421
+ return (-(a *
422
+ Math.pow(2, 10 * (t -= 1)) *
423
+ Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + b);
424
+ },
425
+ ElasticEaseOut(t, b, c, d, a, p) {
426
+ let s = 0;
427
+ if (t === 0) {
428
+ return b;
429
+ }
430
+ if ((t /= d) === 1) {
431
+ return b + c;
432
+ }
433
+ if (!p) {
434
+ p = d * 0.3;
435
+ }
436
+ if (!a || a < Math.abs(c)) {
437
+ a = c;
438
+ s = p / 4;
439
+ }
440
+ else {
441
+ s = (p / (2 * Math.PI)) * Math.asin(c / a);
442
+ }
443
+ return (a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) +
444
+ c +
445
+ b);
446
+ },
447
+ ElasticEaseInOut(t, b, c, d, a, p) {
448
+ let s = 0;
449
+ if (t === 0) {
450
+ return b;
451
+ }
452
+ if ((t /= d / 2) === 2) {
453
+ return b + c;
454
+ }
455
+ if (!p) {
456
+ p = d * (0.3 * 1.5);
457
+ }
458
+ if (!a || a < Math.abs(c)) {
459
+ a = c;
460
+ s = p / 4;
461
+ }
462
+ else {
463
+ s = (p / (2 * Math.PI)) * Math.asin(c / a);
464
+ }
465
+ if (t < 1) {
466
+ return (-0.5 *
467
+ (a *
468
+ Math.pow(2, 10 * (t -= 1)) *
469
+ Math.sin(((t * d - s) * (2 * Math.PI)) / p)) +
470
+ b);
471
+ }
472
+ return (a *
473
+ Math.pow(2, -10 * (t -= 1)) *
474
+ Math.sin(((t * d - s) * (2 * Math.PI)) / p) *
475
+ 0.5 +
476
+ c +
477
+ b);
478
+ },
479
+ BounceEaseOut(t, b, c, d) {
480
+ if ((t /= d) < 1 / 2.75) {
481
+ return c * (7.5625 * t * t) + b;
482
+ }
483
+ else if (t < 2 / 2.75) {
484
+ return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b;
485
+ }
486
+ else if (t < 2.5 / 2.75) {
487
+ return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b;
488
+ }
489
+ else {
490
+ return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b;
491
+ }
492
+ },
493
+ BounceEaseIn(t, b, c, d) {
494
+ return c - Easings.BounceEaseOut(d - t, 0, c, d) + b;
495
+ },
496
+ BounceEaseInOut(t, b, c, d) {
497
+ if (t < d / 2) {
498
+ return Easings.BounceEaseIn(t * 2, 0, c, d) * 0.5 + b;
499
+ }
500
+ else {
501
+ return Easings.BounceEaseOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;
502
+ }
503
+ },
504
+ EaseIn(t, b, c, d) {
505
+ return c * (t /= d) * t + b;
506
+ },
507
+ EaseOut(t, b, c, d) {
508
+ return -c * (t /= d) * (t - 2) + b;
509
+ },
510
+ EaseInOut(t, b, c, d) {
511
+ if ((t /= d / 2) < 1) {
512
+ return (c / 2) * t * t + b;
513
+ }
514
+ return (-c / 2) * (--t * (t - 2) - 1) + b;
515
+ },
516
+ StrongEaseIn(t, b, c, d) {
517
+ return c * (t /= d) * t * t * t * t + b;
518
+ },
519
+ StrongEaseOut(t, b, c, d) {
520
+ return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
521
+ },
522
+ StrongEaseInOut(t, b, c, d) {
523
+ if ((t /= d / 2) < 1) {
524
+ return (c / 2) * t * t * t * t * t + b;
525
+ }
526
+ return (c / 2) * ((t -= 2) * t * t * t * t + 2) + b;
527
+ },
528
+ Linear(t, b, c, d) {
529
+ return (c * t) / d + b;
530
+ },
531
+ };