@bitbybit-dev/base 0.19.6 → 0.19.8

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 (61) hide show
  1. package/babel.config.cjs +0 -1
  2. package/{index.js → index.ts} +2 -1
  3. package/lib/api/inputs/base-inputs.ts +18 -0
  4. package/lib/api/inputs/{color-inputs.d.ts → color-inputs.ts} +48 -26
  5. package/lib/api/inputs/{lists-inputs.d.ts → lists-inputs.ts} +190 -91
  6. package/lib/api/inputs/{logic-inputs.d.ts → logic-inputs.ts} +46 -24
  7. package/lib/api/inputs/{math-inputs.d.ts → math-inputs.ts} +97 -53
  8. package/lib/api/inputs/{point-inputs.d.ts → point-inputs.ts} +168 -77
  9. package/lib/api/inputs/text-inputs.ts +108 -0
  10. package/lib/api/inputs/{transforms-inputs.d.ts → transforms-inputs.ts} +64 -35
  11. package/lib/api/inputs/{vector-inputs.d.ts → vector-inputs.ts} +104 -48
  12. package/lib/api/services/color.test.ts +86 -0
  13. package/lib/api/services/{color.js → color.ts} +34 -15
  14. package/lib/api/services/{geometry-helper.js → geometry-helper.ts} +43 -31
  15. package/lib/api/services/{index.d.ts → index.ts} +1 -1
  16. package/lib/api/services/lists.test.ts +612 -0
  17. package/lib/api/services/{lists.js → lists.ts} +83 -59
  18. package/lib/api/services/logic.test.ts +187 -0
  19. package/lib/api/services/{logic.js → logic.ts} +32 -24
  20. package/lib/api/services/math.test.ts +622 -0
  21. package/lib/api/services/{math.js → math.ts} +136 -71
  22. package/lib/api/services/{point.js → point.ts} +67 -32
  23. package/lib/api/services/text.test.ts +55 -0
  24. package/lib/api/services/{text.js → text.ts} +17 -7
  25. package/lib/api/services/{transforms.js → transforms.ts} +83 -37
  26. package/lib/api/services/vector.test.ts +360 -0
  27. package/lib/api/services/{vector.js → vector.ts} +80 -42
  28. package/lib/{index.d.ts → index.ts} +1 -0
  29. package/package.json +1 -1
  30. package/tsconfig.bitbybit.json +26 -0
  31. package/tsconfig.json +24 -0
  32. package/babel.config.d.cts +0 -5
  33. package/index.d.ts +0 -1
  34. package/lib/api/index.js +0 -1
  35. package/lib/api/inputs/base-inputs.d.ts +0 -35
  36. package/lib/api/inputs/base-inputs.js +0 -1
  37. package/lib/api/inputs/color-inputs.js +0 -164
  38. package/lib/api/inputs/index.js +0 -9
  39. package/lib/api/inputs/inputs.js +0 -9
  40. package/lib/api/inputs/lists-inputs.js +0 -576
  41. package/lib/api/inputs/logic-inputs.js +0 -111
  42. package/lib/api/inputs/math-inputs.js +0 -391
  43. package/lib/api/inputs/point-inputs.js +0 -521
  44. package/lib/api/inputs/text-inputs.d.ts +0 -83
  45. package/lib/api/inputs/text-inputs.js +0 -120
  46. package/lib/api/inputs/transforms-inputs.js +0 -200
  47. package/lib/api/inputs/vector-inputs.js +0 -304
  48. package/lib/api/services/color.d.ts +0 -114
  49. package/lib/api/services/geometry-helper.d.ts +0 -15
  50. package/lib/api/services/index.js +0 -9
  51. package/lib/api/services/lists.d.ts +0 -287
  52. package/lib/api/services/logic.d.ts +0 -99
  53. package/lib/api/services/math.d.ts +0 -349
  54. package/lib/api/services/point.d.ts +0 -222
  55. package/lib/api/services/text.d.ts +0 -69
  56. package/lib/api/services/transforms.d.ts +0 -122
  57. package/lib/api/services/vector.d.ts +0 -320
  58. package/lib/index.js +0 -1
  59. /package/lib/api/{index.d.ts → index.ts} +0 -0
  60. /package/lib/api/inputs/{index.d.ts → index.ts} +0 -0
  61. /package/lib/api/inputs/{inputs.d.ts → inputs.ts} +0 -0
@@ -1,8 +1,10 @@
1
1
  import * as Inputs from "../inputs";
2
+
2
3
  /**
3
4
  * Contains various math methods.
4
5
  */
5
6
  export class MathBitByBit {
7
+
6
8
  /**
7
9
  * Creates a number
8
10
  * @param inputs a number to be created
@@ -11,9 +13,10 @@ export class MathBitByBit {
11
13
  * @shortname number
12
14
  * @drawable false
13
15
  */
14
- number(inputs) {
16
+ number(inputs: Inputs.Math.NumberDto): number {
15
17
  return inputs.number;
16
18
  }
19
+
17
20
  /**
18
21
  * Does basic math operations
19
22
  * @param inputs two numbers and operator
@@ -22,7 +25,7 @@ export class MathBitByBit {
22
25
  * @shortname two numbers
23
26
  * @drawable false
24
27
  */
25
- twoNrOperation(inputs) {
28
+ twoNrOperation(inputs: Inputs.Math.ActionOnTwoNumbersDto): number {
26
29
  let result;
27
30
  switch (inputs.operation) {
28
31
  case Inputs.Math.mathTwoNrOperatorEnum.add:
@@ -48,6 +51,7 @@ export class MathBitByBit {
48
51
  }
49
52
  return result;
50
53
  }
54
+
51
55
  /**
52
56
  * Does modulus operation
53
57
  * @param inputs two numbers and operator
@@ -56,9 +60,10 @@ export class MathBitByBit {
56
60
  * @shortname modulus
57
61
  * @drawable false
58
62
  */
59
- modulus(inputs) {
63
+ modulus(inputs: Inputs.Math.ModulusDto): number {
60
64
  return this.twoNrOperation({ first: inputs.number, second: inputs.modulus, operation: Inputs.Math.mathTwoNrOperatorEnum.modulus });
61
65
  }
66
+
62
67
  /**
63
68
  * Does rounding to decimals
64
69
  * @param inputs a number and decimal places
@@ -67,9 +72,10 @@ export class MathBitByBit {
67
72
  * @shortname round to decimals
68
73
  * @drawable false
69
74
  */
70
- roundToDecimals(inputs) {
75
+ roundToDecimals(inputs: Inputs.Math.RoundToDecimalsDto): number {
71
76
  return Math.round(inputs.number * Math.pow(10, inputs.decimalPlaces)) / Math.pow(10, inputs.decimalPlaces);
72
77
  }
78
+
73
79
  /**
74
80
  * Does basic math operations on one number
75
81
  * @param inputs one number and operator action
@@ -78,7 +84,7 @@ export class MathBitByBit {
78
84
  * @shortname one number
79
85
  * @drawable false
80
86
  */
81
- oneNrOperation(inputs) {
87
+ oneNrOperation(inputs: Inputs.Math.ActionOnOneNumberDto): number {
82
88
  let result;
83
89
  switch (inputs.operation) {
84
90
  case Inputs.Math.mathOneNrOperatorEnum.absolute:
@@ -143,6 +149,7 @@ export class MathBitByBit {
143
149
  }
144
150
  return result;
145
151
  }
152
+
146
153
  /**
147
154
  * Remaps a number from one range to another
148
155
  * @param inputs one number and operator action
@@ -151,9 +158,10 @@ export class MathBitByBit {
151
158
  * @shortname remap
152
159
  * @drawable false
153
160
  */
154
- remap(inputs) {
161
+ remap(inputs: Inputs.Math.RemapNumberDto): number {
155
162
  return (inputs.number - inputs.fromLow) * (inputs.toHigh - inputs.toLow) / (inputs.fromHigh - inputs.fromLow) + inputs.toLow;
156
163
  }
164
+
157
165
  /**
158
166
  * Creates a random number between 0 and 1
159
167
  * @returns A random number between 0 and 1
@@ -161,9 +169,10 @@ export class MathBitByBit {
161
169
  * @shortname random 0 - 1
162
170
  * @drawable false
163
171
  */
164
- random() {
172
+ random(): number {
165
173
  return Math.random();
166
174
  }
175
+
167
176
  /**
168
177
  * Creates a random number between low and high value
169
178
  * @param inputs low and high numbers
@@ -172,9 +181,10 @@ export class MathBitByBit {
172
181
  * @shortname random number
173
182
  * @drawable false
174
183
  */
175
- randomNumber(inputs) {
184
+ randomNumber(inputs: Inputs.Math.RandomNumberDto): number {
176
185
  return Math.random() * (inputs.high - inputs.low) + inputs.low;
177
186
  }
187
+
178
188
  /**
179
189
  * Creates random numbers between low and high values
180
190
  * @param inputs low and high numbers
@@ -183,13 +193,14 @@ export class MathBitByBit {
183
193
  * @shortname random numbers
184
194
  * @drawable false
185
195
  */
186
- randomNumbers(inputs) {
196
+ randomNumbers(inputs: Inputs.Math.RandomNumbersDto): number[] {
187
197
  const result = [];
188
198
  for (let i = 0; i < inputs.count; i++) {
189
199
  result.push(this.randomNumber(inputs));
190
200
  }
191
201
  return result;
192
202
  }
203
+
193
204
  /**
194
205
  * Creates a PI number
195
206
  * @returns A number PI
@@ -197,9 +208,10 @@ export class MathBitByBit {
197
208
  * @shortname π
198
209
  * @drawable false
199
210
  */
200
- pi() {
211
+ pi(): number {
201
212
  return Math.PI;
202
213
  }
214
+
203
215
  /**
204
216
  * Rounds the number to decimal places
205
217
  * @param inputs a number to be rounded to decimal places
@@ -208,9 +220,10 @@ export class MathBitByBit {
208
220
  * @shortname to fixed
209
221
  * @drawable false
210
222
  */
211
- toFixed(inputs) {
223
+ toFixed(inputs: Inputs.Math.ToFixedDto): string {
212
224
  return inputs.number.toFixed(inputs.decimalPlaces);
213
225
  }
226
+
214
227
  /**
215
228
  * Adds two numbers
216
229
  * @param inputs two numbers
@@ -219,9 +232,10 @@ export class MathBitByBit {
219
232
  * @shortname add
220
233
  * @drawable false
221
234
  */
222
- add(inputs) {
235
+ add(inputs: Inputs.Math.TwoNumbersDto): number {
223
236
  return inputs.first + inputs.second;
224
237
  }
238
+
225
239
  /**
226
240
  * Subtracts two numbers
227
241
  * @param inputs two numbers
@@ -230,9 +244,10 @@ export class MathBitByBit {
230
244
  * @shortname subtract
231
245
  * @drawable false
232
246
  */
233
- subtract(inputs) {
247
+ subtract(inputs: Inputs.Math.TwoNumbersDto): number {
234
248
  return inputs.first - inputs.second;
235
249
  }
250
+
236
251
  /**
237
252
  * Multiplies two numbers
238
253
  * @param inputs two numbers
@@ -241,9 +256,10 @@ export class MathBitByBit {
241
256
  * @shortname multiply
242
257
  * @drawable false
243
258
  */
244
- multiply(inputs) {
259
+ multiply(inputs: Inputs.Math.TwoNumbersDto): number {
245
260
  return inputs.first * inputs.second;
246
261
  }
262
+
247
263
  /**
248
264
  * Divides two numbers
249
265
  * @param inputs two numbers
@@ -252,9 +268,10 @@ export class MathBitByBit {
252
268
  * @shortname divide
253
269
  * @drawable false
254
270
  */
255
- divide(inputs) {
271
+ divide(inputs: Inputs.Math.TwoNumbersDto): number {
256
272
  return inputs.first / inputs.second;
257
273
  }
274
+
258
275
  /**
259
276
  * Powers a number
260
277
  * @param inputs two numbers
@@ -263,9 +280,10 @@ export class MathBitByBit {
263
280
  * @shortname power
264
281
  * @drawable false
265
282
  */
266
- power(inputs) {
283
+ power(inputs: Inputs.Math.TwoNumbersDto): number {
267
284
  return Math.pow(inputs.first, inputs.second);
268
285
  }
286
+
269
287
  /**
270
288
  * Gets the square root of a number
271
289
  * @param inputs a number
@@ -274,9 +292,10 @@ export class MathBitByBit {
274
292
  * @shortname sqrt
275
293
  * @drawable false
276
294
  */
277
- sqrt(inputs) {
295
+ sqrt(inputs: Inputs.Math.NumberDto): number {
278
296
  return Math.sqrt(inputs.number);
279
297
  }
298
+
280
299
  /**
281
300
  * Gets the absolute value of a number
282
301
  * @param inputs a number
@@ -285,9 +304,10 @@ export class MathBitByBit {
285
304
  * @shortname abs
286
305
  * @drawable false
287
306
  */
288
- abs(inputs) {
307
+ abs(inputs: Inputs.Math.NumberDto): number {
289
308
  return Math.abs(inputs.number);
290
309
  }
310
+
291
311
  /**
292
312
  * Rounds a number
293
313
  * @param inputs a number
@@ -296,9 +316,10 @@ export class MathBitByBit {
296
316
  * @shortname round
297
317
  * @drawable false
298
318
  */
299
- round(inputs) {
319
+ round(inputs: Inputs.Math.NumberDto): number {
300
320
  return Math.round(inputs.number);
301
321
  }
322
+
302
323
  /**
303
324
  * Floors a number
304
325
  * @param inputs a number
@@ -307,9 +328,10 @@ export class MathBitByBit {
307
328
  * @shortname floor
308
329
  * @drawable false
309
330
  */
310
- floor(inputs) {
331
+ floor(inputs: Inputs.Math.NumberDto): number {
311
332
  return Math.floor(inputs.number);
312
333
  }
334
+
313
335
  /**
314
336
  * Ceils a number
315
337
  * @param inputs a number
@@ -318,9 +340,10 @@ export class MathBitByBit {
318
340
  * @shortname ceil
319
341
  * @drawable false
320
342
  */
321
- ceil(inputs) {
343
+ ceil(inputs: Inputs.Math.NumberDto): number {
322
344
  return Math.ceil(inputs.number);
323
345
  }
346
+
324
347
  /**
325
348
  * Negates a number
326
349
  * @param inputs a number
@@ -329,9 +352,10 @@ export class MathBitByBit {
329
352
  * @shortname negate
330
353
  * @drawable false
331
354
  */
332
- negate(inputs) {
355
+ negate(inputs: Inputs.Math.NumberDto): number {
333
356
  return -inputs.number;
334
357
  }
358
+
335
359
  /**
336
360
  * Gets the natural logarithm of a number
337
361
  * @param inputs a number
@@ -340,9 +364,10 @@ export class MathBitByBit {
340
364
  * @shortname ln
341
365
  * @drawable false
342
366
  */
343
- ln(inputs) {
367
+ ln(inputs: Inputs.Math.NumberDto): number {
344
368
  return Math.log(inputs.number);
345
369
  }
370
+
346
371
  /**
347
372
  * Gets the base 10 logarithm of a number
348
373
  * @param inputs a number
@@ -351,9 +376,10 @@ export class MathBitByBit {
351
376
  * @shortname log10
352
377
  * @drawable false
353
378
  */
354
- log10(inputs) {
379
+ log10(inputs: Inputs.Math.NumberDto): number {
355
380
  return Math.log10(inputs.number);
356
381
  }
382
+
357
383
  /**
358
384
  * Raises 10 to the power of a number
359
385
  * @param inputs a number
@@ -362,9 +388,10 @@ export class MathBitByBit {
362
388
  * @shortname ten pow
363
389
  * @drawable false
364
390
  */
365
- tenPow(inputs) {
391
+ tenPow(inputs: Inputs.Math.NumberDto): number {
366
392
  return Math.pow(10, inputs.number);
367
393
  }
394
+
368
395
  /**
369
396
  * Gets the sine of a number
370
397
  * @param inputs a number
@@ -373,9 +400,10 @@ export class MathBitByBit {
373
400
  * @shortname sin
374
401
  * @drawable false
375
402
  */
376
- sin(inputs) {
403
+ sin(inputs: Inputs.Math.NumberDto): number {
377
404
  return Math.sin(inputs.number);
378
405
  }
406
+
379
407
  /**
380
408
  * Gets the cosine of a number
381
409
  * @param inputs a number
@@ -384,9 +412,10 @@ export class MathBitByBit {
384
412
  * @shortname cos
385
413
  * @drawable false
386
414
  */
387
- cos(inputs) {
415
+ cos(inputs: Inputs.Math.NumberDto): number {
388
416
  return Math.cos(inputs.number);
389
417
  }
418
+
390
419
  /**
391
420
  * Gets the tangent of a number
392
421
  * @param inputs a number
@@ -395,9 +424,10 @@ export class MathBitByBit {
395
424
  * @shortname tan
396
425
  * @drawable false
397
426
  */
398
- tan(inputs) {
427
+ tan(inputs: Inputs.Math.NumberDto): number {
399
428
  return Math.tan(inputs.number);
400
429
  }
430
+
401
431
  /**
402
432
  * Gets the arcsine of a number
403
433
  * @param inputs a number
@@ -406,9 +436,10 @@ export class MathBitByBit {
406
436
  * @shortname asin
407
437
  * @drawable false
408
438
  */
409
- asin(inputs) {
439
+ asin(inputs: Inputs.Math.NumberDto): number {
410
440
  return Math.asin(inputs.number);
411
441
  }
442
+
412
443
  /**
413
444
  * Gets the arccosine of a number
414
445
  * @param inputs a number
@@ -417,9 +448,10 @@ export class MathBitByBit {
417
448
  * @shortname acos
418
449
  * @drawable false
419
450
  */
420
- acos(inputs) {
451
+ acos(inputs: Inputs.Math.NumberDto): number {
421
452
  return Math.acos(inputs.number);
422
453
  }
454
+
423
455
  /**
424
456
  * Gets the arctangent of a number
425
457
  * @param inputs a number
@@ -428,9 +460,10 @@ export class MathBitByBit {
428
460
  * @shortname atan
429
461
  * @drawable false
430
462
  */
431
- atan(inputs) {
463
+ atan(inputs: Inputs.Math.NumberDto): number {
432
464
  return Math.atan(inputs.number);
433
465
  }
466
+
434
467
  /**
435
468
  * Gets the natural exponent of a number
436
469
  * @param inputs a number
@@ -439,9 +472,10 @@ export class MathBitByBit {
439
472
  * @shortname exp
440
473
  * @drawable false
441
474
  */
442
- exp(inputs) {
475
+ exp(inputs: Inputs.Math.NumberDto): number {
443
476
  return Math.exp(inputs.number);
444
477
  }
478
+
445
479
  /**
446
480
  * Converts degrees to radians
447
481
  * @param inputs a number in degrees
@@ -450,9 +484,10 @@ export class MathBitByBit {
450
484
  * @shortname deg to rad
451
485
  * @drawable false
452
486
  */
453
- degToRad(inputs) {
487
+ degToRad(inputs: Inputs.Math.NumberDto): number {
454
488
  return inputs.number * Math.PI / 180;
455
489
  }
490
+
456
491
  /**
457
492
  * Converts radians to degrees
458
493
  * @param inputs a number in radians
@@ -461,9 +496,10 @@ export class MathBitByBit {
461
496
  * @shortname rad to deg
462
497
  * @drawable false
463
498
  */
464
- radToDeg(inputs) {
499
+ radToDeg(inputs: Inputs.Math.NumberDto): number {
465
500
  return inputs.number * 180 / Math.PI;
466
501
  }
502
+
467
503
  /**
468
504
  * Eases a number by providing x parameter 0-1 and a range of output values
469
505
  * @param inputs a number, min and max values, and ease type
@@ -472,66 +508,85 @@ export class MathBitByBit {
472
508
  * @shortname ease
473
509
  * @drawable false
474
510
  */
475
- ease(inputs) {
511
+ ease(inputs: Inputs.Math.EaseDto) {
476
512
  const x = inputs.x;
477
513
  const min = inputs.min;
478
514
  const max = inputs.max;
515
+
479
516
  const y = this[inputs.ease](x);
480
517
  const res = this.remap({ number: y, fromLow: 0, fromHigh: 1, toLow: min, toHigh: max });
481
518
  return res;
482
519
  }
483
- easeInSine(x) {
520
+
521
+ private easeInSine(x: number): number {
484
522
  return 1 - Math.cos((x * Math.PI) / 2);
485
523
  }
486
- easeOutSine(x) {
524
+
525
+ private easeOutSine(x: number): number {
487
526
  return Math.sin((x * Math.PI) / 2);
488
527
  }
489
- easeInOutSine(x) {
528
+
529
+ private easeInOutSine(x: number): number {
490
530
  return -(Math.cos(Math.PI * x) - 1) / 2;
491
531
  }
492
- easeInQuad(x) {
532
+
533
+ private easeInQuad(x: number): number {
493
534
  return x * x;
494
535
  }
495
- easeOutQuad(x) {
536
+
537
+ private easeOutQuad(x: number): number {
496
538
  return 1 - (1 - x) * (1 - x);
497
539
  }
498
- easeInOutQuad(x) {
540
+
541
+ private easeInOutQuad(x: number): number {
499
542
  return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2;
500
543
  }
501
- easeInCubic(x) {
544
+
545
+ private easeInCubic(x: number): number {
502
546
  return x * x * x;
503
547
  }
504
- easeOutCubic(x) {
548
+
549
+ private easeOutCubic(x: number): number {
505
550
  return 1 - Math.pow(1 - x, 3);
506
551
  }
507
- easeInOutCubic(x) {
552
+
553
+ private easeInOutCubic(x: number): number {
508
554
  return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
509
555
  }
510
- easeInQuart(x) {
556
+
557
+ private easeInQuart(x: number): number {
511
558
  return x * x * x * x;
512
559
  }
513
- easeOutQuart(x) {
560
+
561
+ private easeOutQuart(x: number): number {
514
562
  return 1 - Math.pow(1 - x, 4);
515
563
  }
516
- easeInOutQuart(x) {
564
+
565
+ private easeInOutQuart(x: number): number {
517
566
  return x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2;
518
567
  }
519
- easeInQuint(x) {
568
+
569
+ private easeInQuint(x: number): number {
520
570
  return x * x * x * x * x;
521
571
  }
522
- easeOutQuint(x) {
572
+
573
+ private easeOutQuint(x: number): number {
523
574
  return 1 - Math.pow(1 - x, 5);
524
575
  }
525
- easeInOutQuint(x) {
576
+
577
+ private easeInOutQuint(x: number): number {
526
578
  return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
527
579
  }
528
- easeInExpo(x) {
580
+
581
+ private easeInExpo(x: number): number {
529
582
  return x === 0 ? 0 : Math.pow(2, 10 * x - 10);
530
583
  }
531
- easeOutExpo(x) {
584
+
585
+ private easeOutExpo(x: number): number {
532
586
  return x === 1 ? 1 : 1 - Math.pow(2, -10 * x);
533
587
  }
534
- easeInOutExpo(x) {
588
+
589
+ private easeInOutExpo(x: number): number {
535
590
  return x === 0
536
591
  ? 0
537
592
  : x === 1
@@ -540,35 +595,42 @@ export class MathBitByBit {
540
595
  ? Math.pow(2, 20 * x - 10) / 2
541
596
  : (2 - Math.pow(2, -20 * x + 10)) / 2;
542
597
  }
543
- easeInCirc(x) {
598
+
599
+ private easeInCirc(x: number): number {
544
600
  return 1 - Math.sqrt(1 - x * x);
545
601
  }
546
- easeOutCirc(x) {
602
+
603
+ private easeOutCirc(x: number): number {
547
604
  return Math.sqrt(1 - Math.pow(x - 1, 2));
548
605
  }
549
- easeInOutCirc(x) {
606
+
607
+ private easeInOutCirc(x: number): number {
550
608
  return x < 0.5
551
609
  ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2
552
610
  : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2;
553
611
  }
554
- easeInBack(x) {
612
+
613
+ private easeInBack(x: number): number {
555
614
  const c1 = 1.70158;
556
615
  const c3 = c1 + 1;
557
616
  return c3 * x * x * x - c1 * x * x;
558
617
  }
559
- easeOutBack(x) {
618
+
619
+ private easeOutBack(x: number): number {
560
620
  const c1 = 1.70158;
561
621
  const c3 = c1 + 1;
562
622
  return 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2);
563
623
  }
564
- easeInOutBack(x) {
624
+
625
+ private easeInOutBack(x: number): number {
565
626
  const c1 = 1.70158;
566
627
  const c2 = c1 * 1.525;
567
628
  return x < 0.5
568
629
  ? (Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2)) / 2
569
630
  : (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
570
631
  }
571
- easeInElastic(x) {
632
+
633
+ private easeInElastic(x: number): number {
572
634
  const c4 = (2 * Math.PI) / 3;
573
635
  return x === 0
574
636
  ? 0
@@ -576,7 +638,8 @@ export class MathBitByBit {
576
638
  ? 1
577
639
  : -Math.pow(2, 10 * x - 10) * Math.sin((x * 10 - 10.75) * c4);
578
640
  }
579
- easeOutElastic(x) {
641
+
642
+ private easeOutElastic(x: number): number {
580
643
  const c4 = (2 * Math.PI) / 3;
581
644
  return x === 0
582
645
  ? 0
@@ -584,7 +647,8 @@ export class MathBitByBit {
584
647
  ? 1
585
648
  : Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1;
586
649
  }
587
- easeInOutElastic(x) {
650
+
651
+ private easeInOutElastic(x: number): number {
588
652
  const c5 = (2 * Math.PI) / 4.5;
589
653
  return x === 0
590
654
  ? 0
@@ -594,28 +658,29 @@ export class MathBitByBit {
594
658
  ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2
595
659
  : (Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5)) / 2 + 1;
596
660
  }
597
- easeInBounce(x) {
661
+
662
+ private easeInBounce(x: number): number {
598
663
  return 1 - this.easeOutBounce(1 - x);
599
664
  }
600
- easeOutBounce(x) {
665
+
666
+ private easeOutBounce(x: number): number {
601
667
  const n1 = 7.5625;
602
668
  const d1 = 2.75;
603
669
  if (x < 1 / d1) {
604
670
  return n1 * x * x;
605
- }
606
- else if (x < 2 / d1) {
671
+ } else if (x < 2 / d1) {
607
672
  return n1 * (x -= 1.5 / d1) * x + 0.75;
608
- }
609
- else if (x < 2.5 / d1) {
673
+ } else if (x < 2.5 / d1) {
610
674
  return n1 * (x -= 2.25 / d1) * x + 0.9375;
611
- }
612
- else {
675
+ } else {
613
676
  return n1 * (x -= 2.625 / d1) * x + 0.984375;
614
677
  }
615
678
  }
616
- easeInOutBounce(x) {
679
+
680
+ private easeInOutBounce(x: number): number {
617
681
  return x < 0.5
618
682
  ? (1 - this.easeOutBounce(1 - 2 * x)) / 2
619
683
  : (1 + this.easeOutBounce(2 * x - 1)) / 2;
620
684
  }
685
+
621
686
  }