@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.
- package/babel.config.cjs +0 -1
- package/{index.js → index.ts} +2 -1
- package/lib/api/inputs/base-inputs.ts +18 -0
- package/lib/api/inputs/{color-inputs.d.ts → color-inputs.ts} +48 -26
- package/lib/api/inputs/{lists-inputs.d.ts → lists-inputs.ts} +190 -91
- package/lib/api/inputs/{logic-inputs.d.ts → logic-inputs.ts} +46 -24
- package/lib/api/inputs/{math-inputs.d.ts → math-inputs.ts} +97 -53
- package/lib/api/inputs/{point-inputs.d.ts → point-inputs.ts} +168 -77
- package/lib/api/inputs/text-inputs.ts +108 -0
- package/lib/api/inputs/{transforms-inputs.d.ts → transforms-inputs.ts} +64 -35
- package/lib/api/inputs/{vector-inputs.d.ts → vector-inputs.ts} +104 -48
- package/lib/api/services/color.test.ts +86 -0
- package/lib/api/services/{color.js → color.ts} +34 -15
- package/lib/api/services/{geometry-helper.js → geometry-helper.ts} +43 -31
- package/lib/api/services/{index.d.ts → index.ts} +1 -1
- package/lib/api/services/lists.test.ts +612 -0
- package/lib/api/services/{lists.js → lists.ts} +83 -59
- package/lib/api/services/logic.test.ts +187 -0
- package/lib/api/services/{logic.js → logic.ts} +32 -24
- package/lib/api/services/math.test.ts +622 -0
- package/lib/api/services/{math.js → math.ts} +136 -71
- package/lib/api/services/{point.js → point.ts} +67 -32
- package/lib/api/services/text.test.ts +55 -0
- package/lib/api/services/{text.js → text.ts} +17 -7
- package/lib/api/services/{transforms.js → transforms.ts} +83 -37
- package/lib/api/services/vector.test.ts +360 -0
- package/lib/api/services/{vector.js → vector.ts} +80 -42
- package/lib/{index.d.ts → index.ts} +1 -0
- package/package.json +1 -1
- package/tsconfig.bitbybit.json +26 -0
- package/tsconfig.json +24 -0
- package/babel.config.d.cts +0 -5
- package/index.d.ts +0 -1
- package/lib/api/index.js +0 -1
- package/lib/api/inputs/base-inputs.d.ts +0 -35
- package/lib/api/inputs/base-inputs.js +0 -1
- package/lib/api/inputs/color-inputs.js +0 -164
- package/lib/api/inputs/index.js +0 -9
- package/lib/api/inputs/inputs.js +0 -9
- package/lib/api/inputs/lists-inputs.js +0 -576
- package/lib/api/inputs/logic-inputs.js +0 -111
- package/lib/api/inputs/math-inputs.js +0 -391
- package/lib/api/inputs/point-inputs.js +0 -521
- package/lib/api/inputs/text-inputs.d.ts +0 -83
- package/lib/api/inputs/text-inputs.js +0 -120
- package/lib/api/inputs/transforms-inputs.js +0 -200
- package/lib/api/inputs/vector-inputs.js +0 -304
- package/lib/api/services/color.d.ts +0 -114
- package/lib/api/services/geometry-helper.d.ts +0 -15
- package/lib/api/services/index.js +0 -9
- package/lib/api/services/lists.d.ts +0 -287
- package/lib/api/services/logic.d.ts +0 -99
- package/lib/api/services/math.d.ts +0 -349
- package/lib/api/services/point.d.ts +0 -222
- package/lib/api/services/text.d.ts +0 -69
- package/lib/api/services/transforms.d.ts +0 -122
- package/lib/api/services/vector.d.ts +0 -320
- package/lib/index.js +0 -1
- /package/lib/api/{index.d.ts → index.ts} +0 -0
- /package/lib/api/inputs/{index.d.ts → index.ts} +0 -0
- /package/lib/api/inputs/{inputs.d.ts → inputs.ts} +0 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
import { MathBitByBit } from "./math";
|
|
2
|
+
import * as Inputs from "../inputs";
|
|
3
|
+
|
|
4
|
+
describe("Math unit tests", () => {
|
|
5
|
+
let math: MathBitByBit;
|
|
6
|
+
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
math = new MathBitByBit();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should create number", () => {
|
|
12
|
+
const result = math.number({ number: 1 });
|
|
13
|
+
expect(result).toEqual(1);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should perform addition", () => {
|
|
17
|
+
const result = math.twoNrOperation({ first: 1, second: 2, operation: Inputs.Math.mathTwoNrOperatorEnum.add });
|
|
18
|
+
expect(result).toEqual(3);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should perform subtraction", () => {
|
|
22
|
+
const result = math.twoNrOperation({ first: 1, second: 2, operation: Inputs.Math.mathTwoNrOperatorEnum.subtract });
|
|
23
|
+
expect(result).toEqual(-1);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("should perform multiplication", () => {
|
|
27
|
+
const result = math.twoNrOperation({ first: 1, second: 2, operation: Inputs.Math.mathTwoNrOperatorEnum.multiply });
|
|
28
|
+
expect(result).toEqual(2);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should perform division", () => {
|
|
32
|
+
const result = math.twoNrOperation({ first: 1, second: 2, operation: Inputs.Math.mathTwoNrOperatorEnum.divide });
|
|
33
|
+
expect(result).toEqual(0.5);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should perform modulus", () => {
|
|
37
|
+
const result = math.twoNrOperation({ first: 1, second: 2, operation: Inputs.Math.mathTwoNrOperatorEnum.modulus });
|
|
38
|
+
expect(result).toEqual(1);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("should perform power", () => {
|
|
42
|
+
const result = math.twoNrOperation({ first: 2, second: 3, operation: Inputs.Math.mathTwoNrOperatorEnum.power });
|
|
43
|
+
expect(result).toEqual(8);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("should not perform unknown two nr operation", () => {
|
|
47
|
+
const result = math.twoNrOperation({ first: 2, second: 3, operation: "unknown" as any });
|
|
48
|
+
expect(result).toEqual(undefined);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should perform square root", () => {
|
|
52
|
+
const result = math.oneNrOperation({ number: 4, operation: Inputs.Math.mathOneNrOperatorEnum.sqrt });
|
|
53
|
+
expect(result).toEqual(2);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should perform absolute", () => {
|
|
57
|
+
const result = math.oneNrOperation({ number: -4, operation: Inputs.Math.mathOneNrOperatorEnum.absolute });
|
|
58
|
+
expect(result).toEqual(4);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("should perform round", () => {
|
|
62
|
+
const result = math.oneNrOperation({ number: 4.5, operation: Inputs.Math.mathOneNrOperatorEnum.round });
|
|
63
|
+
expect(result).toEqual(5);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("should perform floor", () => {
|
|
67
|
+
const result = math.oneNrOperation({ number: 4.5, operation: Inputs.Math.mathOneNrOperatorEnum.floor });
|
|
68
|
+
expect(result).toEqual(4);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("should perform ceiling", () => {
|
|
72
|
+
const result = math.oneNrOperation({ number: 4.5, operation: Inputs.Math.mathOneNrOperatorEnum.ceil });
|
|
73
|
+
expect(result).toEqual(5);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("should perform negate", () => {
|
|
77
|
+
const result = math.oneNrOperation({ number: 4, operation: Inputs.Math.mathOneNrOperatorEnum.negate });
|
|
78
|
+
expect(result).toEqual(-4);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("should perform natural logarithm", () => {
|
|
82
|
+
const result = math.oneNrOperation({ number: 4, operation: Inputs.Math.mathOneNrOperatorEnum.ln });
|
|
83
|
+
expect(result).toEqual(1.3862943611198906);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("should perform log base 10", () => {
|
|
87
|
+
const result = math.oneNrOperation({ number: 100, operation: Inputs.Math.mathOneNrOperatorEnum.log10 });
|
|
88
|
+
expect(result).toEqual(2);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("should perform 10 to the power", () => {
|
|
92
|
+
const result = math.oneNrOperation({ number: 2, operation: Inputs.Math.mathOneNrOperatorEnum.tenPow });
|
|
93
|
+
expect(result).toEqual(100);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("should perform sine", () => {
|
|
97
|
+
const result = math.oneNrOperation({ number: 90, operation: Inputs.Math.mathOneNrOperatorEnum.sin });
|
|
98
|
+
expect(result).toEqual(0.8939966636005579);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("should perform cosine", () => {
|
|
102
|
+
const result = math.oneNrOperation({ number: 90, operation: Inputs.Math.mathOneNrOperatorEnum.cos });
|
|
103
|
+
expect(result).toEqual(-0.4480736161291702);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("should perform tangent", () => {
|
|
107
|
+
const result = math.oneNrOperation({ number: 90, operation: Inputs.Math.mathOneNrOperatorEnum.tan });
|
|
108
|
+
expect(result).toEqual(-1.995200412208242);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("should perform arcsine", () => {
|
|
112
|
+
const result = math.oneNrOperation({ number: 0.5, operation: Inputs.Math.mathOneNrOperatorEnum.asin });
|
|
113
|
+
expect(result).toEqual(0.5235987755982989);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("should perform acos", () => {
|
|
117
|
+
const result = math.oneNrOperation({ number: 0.5, operation: Inputs.Math.mathOneNrOperatorEnum.acos });
|
|
118
|
+
expect(result).toEqual(1.0471975511965979);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("should perform atan", () => {
|
|
122
|
+
const result = math.oneNrOperation({ number: 0.5, operation: Inputs.Math.mathOneNrOperatorEnum.atan });
|
|
123
|
+
expect(result).toEqual(0.4636476090008061);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("should perform exponential", () => {
|
|
127
|
+
const result = math.oneNrOperation({ number: 2, operation: Inputs.Math.mathOneNrOperatorEnum.exp });
|
|
128
|
+
expect(result).toEqual(7.38905609893065);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("should perform log", () => {
|
|
132
|
+
const result = math.oneNrOperation({ number: 2, operation: Inputs.Math.mathOneNrOperatorEnum.log });
|
|
133
|
+
expect(result).toEqual(0.6931471805599453);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("should convert deg to rad", () => {
|
|
137
|
+
const result = math.oneNrOperation({ number: 90, operation: Inputs.Math.mathOneNrOperatorEnum.degToRad });
|
|
138
|
+
expect(result).toEqual(1.5707963267948966);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("should convert rad to deg", () => {
|
|
142
|
+
const result = math.oneNrOperation({ number: 3.14, operation: Inputs.Math.mathOneNrOperatorEnum.radToDeg });
|
|
143
|
+
expect(result).toEqual(179.90874767107852);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("should convert rad to deg", () => {
|
|
147
|
+
const result = math.oneNrOperation({ number: 3.14, operation: "unknown" as any });
|
|
148
|
+
expect(result).toEqual(undefined);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("should remap a number", () => {
|
|
152
|
+
const result = math.remap({ number: 0.5, fromLow: 0, fromHigh: 1, toLow: 0, toHigh: 10 });
|
|
153
|
+
expect(result).toEqual(5);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("should compute modulus for number", () => {
|
|
157
|
+
const result = math.modulus({ number: 5, modulus: 2 });
|
|
158
|
+
expect(result).toEqual(1);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("should round to decimals", () => {
|
|
162
|
+
const result = math.roundToDecimals({ number: 5.12345, decimalPlaces: 2 });
|
|
163
|
+
expect(result).toEqual(5.12);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("should compute random number", () => {
|
|
167
|
+
const result = math.randomNumber({ low: 0, high: 10 });
|
|
168
|
+
expect(result).toBeGreaterThanOrEqual(0);
|
|
169
|
+
expect(result).toBeLessThanOrEqual(10);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("should compute random", () => {
|
|
173
|
+
const result = math.random();
|
|
174
|
+
expect(result).toBeGreaterThanOrEqual(0);
|
|
175
|
+
expect(result).toBeLessThanOrEqual(1);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("should create random numbers", () => {
|
|
179
|
+
const result = math.randomNumbers({ count: 10, low: 0, high: 10 });
|
|
180
|
+
expect(result.length).toEqual(10);
|
|
181
|
+
result.forEach(r => {
|
|
182
|
+
expect(r).toBeGreaterThanOrEqual(0);
|
|
183
|
+
expect(r).toBeLessThanOrEqual(10);
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("should compute pi", () => {
|
|
188
|
+
const result = math.pi();
|
|
189
|
+
expect(result).toEqual(Math.PI);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("should convert nr to fixed", () => {
|
|
193
|
+
const result = math.toFixed({ number: 5.12345, decimalPlaces: 2 });
|
|
194
|
+
expect(result).toEqual("5.12");
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it("should add two numbers", () => {
|
|
198
|
+
const result = math.add({ first: 1, second: 2 });
|
|
199
|
+
expect(result).toEqual(3);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("should subtract two numbers", () => {
|
|
203
|
+
const result = math.subtract({ first: 1, second: 2 });
|
|
204
|
+
expect(result).toEqual(-1);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("should multiply two numbers", () => {
|
|
208
|
+
const result = math.multiply({ first: 1, second: 2 });
|
|
209
|
+
expect(result).toEqual(2);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("should divide two numbers", () => {
|
|
213
|
+
const result = math.divide({ first: 1, second: 2 });
|
|
214
|
+
expect(result).toEqual(0.5);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it("should compute power", () => {
|
|
218
|
+
const result = math.power({ first: 2, second: 3 });
|
|
219
|
+
expect(result).toEqual(8);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("should compute square root", () => {
|
|
223
|
+
const result = math.sqrt({ number: 4 });
|
|
224
|
+
expect(result).toEqual(2);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it("should compute absolute", () => {
|
|
228
|
+
const result = math.abs({ number: -4 });
|
|
229
|
+
expect(result).toEqual(4);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("should compute round", () => {
|
|
233
|
+
const result = math.round({ number: 4.5 });
|
|
234
|
+
expect(result).toEqual(5);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it("should compute floor", () => {
|
|
238
|
+
const result = math.floor({ number: 4.5 });
|
|
239
|
+
expect(result).toEqual(4);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it("should compute ceiling", () => {
|
|
243
|
+
const result = math.ceil({ number: 4.5 });
|
|
244
|
+
expect(result).toEqual(5);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it("should compute negate", () => {
|
|
248
|
+
const result = math.negate({ number: 4 });
|
|
249
|
+
expect(result).toEqual(-4);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it("should compute natural logarithm", () => {
|
|
253
|
+
const result = math.ln({ number: 4 });
|
|
254
|
+
expect(result).toEqual(1.3862943611198906);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("should compute log base 10", () => {
|
|
258
|
+
const result = math.log10({ number: 100 });
|
|
259
|
+
expect(result).toEqual(2);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("should compute 10 to the power", () => {
|
|
263
|
+
const result = math.tenPow({ number: 2 });
|
|
264
|
+
expect(result).toEqual(100);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it("should compute sine", () => {
|
|
268
|
+
const result = math.sin({ number: 90 });
|
|
269
|
+
expect(result).toEqual(0.8939966636005579);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it("should compute cosine", () => {
|
|
273
|
+
const result = math.cos({ number: 90 });
|
|
274
|
+
expect(result).toEqual(-0.4480736161291702);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it("should compute tangent", () => {
|
|
278
|
+
const result = math.tan({ number: 90 });
|
|
279
|
+
expect(result).toEqual(-1.995200412208242);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("should compute arcsine", () => {
|
|
283
|
+
const result = math.asin({ number: 0.5 });
|
|
284
|
+
expect(result).toEqual(0.5235987755982989);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it("should compute acos", () => {
|
|
288
|
+
const result = math.acos({ number: 0.5 });
|
|
289
|
+
expect(result).toEqual(1.0471975511965979);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it("should compute atan", () => {
|
|
293
|
+
const result = math.atan({ number: 0.5 });
|
|
294
|
+
expect(result).toEqual(0.4636476090008061);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it("should compute exponential", () => {
|
|
298
|
+
const result = math.exp({ number: 2 });
|
|
299
|
+
expect(result).toEqual(7.38905609893065);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it("should compute deg to rad", () => {
|
|
303
|
+
const result = math.degToRad({ number: 90 });
|
|
304
|
+
expect(result).toEqual(1.5707963267948966);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it("should compute rad to deg", () => {
|
|
308
|
+
const result = math.radToDeg({ number: 3.14 });
|
|
309
|
+
expect(result).toEqual(179.90874767107852);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it("should compute remap", () => {
|
|
313
|
+
const result = math.remap({ number: 0.5, fromLow: 0, fromHigh: 1, toLow: 0, toHigh: 10 });
|
|
314
|
+
expect(result).toEqual(5);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it("should compute ease in sine", () => {
|
|
318
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInSine });
|
|
319
|
+
expect(result).toEqual(0.1089934758116321);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("should compute ease in sine", () => {
|
|
323
|
+
const result = math.ease({ x: 0.7, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInSine });
|
|
324
|
+
expect(result).toEqual(0.5460095002604531);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("should compute ease out sine", () => {
|
|
328
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutSine });
|
|
329
|
+
expect(result).toEqual(0.45399049973954675);
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
it("should compute ease out sine", () => {
|
|
333
|
+
const result = math.ease({ x: 0.7, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutSine });
|
|
334
|
+
expect(result).toEqual(0.8910065241883678);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it("should compute ease in out sine", () => {
|
|
338
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutSine });
|
|
339
|
+
expect(result).toEqual(0.20610737385376343);
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it("should compute ease in out sine", () => {
|
|
343
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutSine });
|
|
344
|
+
expect(result).toEqual(0.9755282581475768);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
it("should compute ease in quad", () => {
|
|
348
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInQuad });
|
|
349
|
+
expect(result).toEqual(0.09);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it("should compute ease in quad", () => {
|
|
353
|
+
const result = math.ease({ x: 0.8, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInQuad });
|
|
354
|
+
expect(result).toEqual(0.6400000000000001);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it("should compute ease out quad", () => {
|
|
358
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutQuad });
|
|
359
|
+
expect(result).toEqual(0.51);
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it("should compute ease out quad", () => {
|
|
363
|
+
const result = math.ease({ x: 0.85, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutQuad });
|
|
364
|
+
expect(result).toEqual(0.9775);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
it("should compute ease in out quad", () => {
|
|
368
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutQuad });
|
|
369
|
+
expect(result).toEqual(0.18);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it("should compute ease in out quad", () => {
|
|
373
|
+
const result = math.ease({ x: 0.7, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutQuad });
|
|
374
|
+
expect(result).toEqual(0.82);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it("should compute ease in cubic", () => {
|
|
378
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInCubic });
|
|
379
|
+
expect(result).toEqual(0.027);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it("should compute ease in cubic", () => {
|
|
383
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInCubic });
|
|
384
|
+
expect(result).toEqual(0.7290000000000001);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it("should compute ease out cubic", () => {
|
|
388
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutCubic });
|
|
389
|
+
expect(result).toEqual(0.657);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it("should compute ease out cubic", () => {
|
|
393
|
+
const result = math.ease({ x: 0.6, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutCubic });
|
|
394
|
+
expect(result).toEqual(0.9359999999999999);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it("should compute ease in out cubic", () => {
|
|
398
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutCubic });
|
|
399
|
+
expect(result).toEqual(0.108);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
it("should compute ease in out cubic", () => {
|
|
403
|
+
const result = math.ease({ x: 0.75, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutCubic });
|
|
404
|
+
expect(result).toEqual(0.9375);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it("should compute ease in quart", () => {
|
|
408
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInQuart });
|
|
409
|
+
expect(result).toEqual(0.0081);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it("should compute ease in quart", () => {
|
|
413
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInQuart });
|
|
414
|
+
expect(result).toEqual(0.6561000000000001);
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
it("should compute ease out quart", () => {
|
|
418
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutQuart });
|
|
419
|
+
expect(result).toEqual(0.7599);
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
it("should compute ease out quart", () => {
|
|
423
|
+
const result = math.ease({ x: 0.87, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutQuart });
|
|
424
|
+
expect(result).toEqual(0.99971439);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it("should compute ease in out quart", () => {
|
|
428
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutQuart });
|
|
429
|
+
expect(result).toEqual(0.0648);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it("should compute ease in out quart", () => {
|
|
433
|
+
const result = math.ease({ x: 0.8, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutQuart });
|
|
434
|
+
expect(result).toEqual(0.9872);
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
it("should compute ease in quint", () => {
|
|
438
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInQuint });
|
|
439
|
+
expect(result).toEqual(0.00243);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it("should compute ease in quint", () => {
|
|
443
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInQuint });
|
|
444
|
+
expect(result).toEqual(0.5904900000000002);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
it("should compute ease out quint", () => {
|
|
448
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutQuint });
|
|
449
|
+
expect(result).toEqual(0.8319300000000001);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it("should compute ease out quint", () => {
|
|
453
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutQuint });
|
|
454
|
+
expect(result).toEqual(0.99999);
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it("should compute ease in out quint", () => {
|
|
458
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutQuint });
|
|
459
|
+
expect(result).toEqual(0.03888);
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
it("should compute ease in out quint", () => {
|
|
463
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutQuint });
|
|
464
|
+
expect(result).toEqual(0.99984);
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
it("should compute ease in expo", () => {
|
|
468
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInExpo });
|
|
469
|
+
expect(result).toEqual(0.0078125);
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
it("should compute ease in expo", () => {
|
|
473
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInExpo });
|
|
474
|
+
expect(result).toEqual(0.5);
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
it("should compute ease out expo", () => {
|
|
478
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutExpo });
|
|
479
|
+
expect(result).toEqual(0.875);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
it("should compute ease out expo", () => {
|
|
483
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutExpo });
|
|
484
|
+
expect(result).toEqual(0.998046875);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
it("should compute ease in out expo", () => {
|
|
488
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutExpo });
|
|
489
|
+
expect(result).toEqual(0.03125);
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
it("should compute ease in out expo", () => {
|
|
493
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutExpo });
|
|
494
|
+
expect(result).toEqual(0.998046875);
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
it("should compute ease in circ", () => {
|
|
498
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInCirc });
|
|
499
|
+
expect(result).toEqual(0.04606079858305434);
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
it("should compute ease in circ", () => {
|
|
503
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInCirc });
|
|
504
|
+
expect(result).toEqual(0.5641101056459328);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it("should compute ease out circ", () => {
|
|
508
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutCirc });
|
|
509
|
+
expect(result).toEqual(0.714142842854285);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it("should compute ease out circ", () => {
|
|
513
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutCirc });
|
|
514
|
+
expect(result).toEqual(0.99498743710662);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
it("should compute ease in out circ", () => {
|
|
518
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutCirc });
|
|
519
|
+
expect(result).toEqual(0.09999999999999998);
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
it("should compute ease in out circ", () => {
|
|
523
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutCirc });
|
|
524
|
+
expect(result).toEqual(0.9898979485566356);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it("should compute ease in elastic", () => {
|
|
528
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInElastic });
|
|
529
|
+
expect(result).toEqual(-0.0039062499999999918);
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
it("should compute ease in elastic", () => {
|
|
533
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInElastic });
|
|
534
|
+
expect(result).toEqual(-0.24999999999999986);
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
it("should compute ease out elastic", () => {
|
|
538
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutElastic });
|
|
539
|
+
expect(result).toEqual(0.875);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
it("should compute ease out elastic", () => {
|
|
543
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutElastic });
|
|
544
|
+
expect(result).toEqual(0.998046875);
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it("should compute ease in out elastic", () => {
|
|
548
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutElastic });
|
|
549
|
+
expect(result).toEqual(0.023938888847468056);
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it("should compute ease in out elastic", () => {
|
|
553
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutElastic });
|
|
554
|
+
expect(result).toEqual(0.9996608434029943);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
it("should compute ease in back", () => {
|
|
558
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInBack });
|
|
559
|
+
expect(result).toEqual(-0.08019953999999999);
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
it("should compute ease in back", () => {
|
|
563
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInBack });
|
|
564
|
+
expect(result).toEqual(0.5911720200000001);
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
it("should compute ease out back", () => {
|
|
568
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutBack });
|
|
569
|
+
expect(result).toEqual(0.9071322600000001);
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
it("should compute ease out back", () => {
|
|
573
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutBack });
|
|
574
|
+
expect(result).toEqual(1.01431422);
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
it("should compute ease in out back", () => {
|
|
578
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutBack });
|
|
579
|
+
expect(result).toEqual(-0.07883348399999998);
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
it("should compute ease in out back", () => {
|
|
583
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutBack });
|
|
584
|
+
expect(result).toEqual(1.0375185519999999);
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it("should compute ease in bounce", () => {
|
|
588
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInBounce });
|
|
589
|
+
expect(result).toEqual(0.06937499999999996);
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
it("should compute ease in bounce", () => {
|
|
593
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInBounce });
|
|
594
|
+
expect(result).toEqual(0.9243750000000001);
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
it("should compute ease out bounce", () => {
|
|
598
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutBounce });
|
|
599
|
+
expect(result).toEqual(0.6806249999999999);
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
it("should compute ease out bounce", () => {
|
|
603
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeOutBounce });
|
|
604
|
+
expect(result).toEqual(0.9881249999999999);
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
it("should compute ease in out bounce", () => {
|
|
608
|
+
const result = math.ease({ x: 0.3, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutBounce });
|
|
609
|
+
expect(result).toEqual(0.045000000000000095);
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
it("should compute ease in out bounce", () => {
|
|
613
|
+
const result = math.ease({ x: 0.9, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutBounce });
|
|
614
|
+
expect(result).toEqual(0.97);
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
it("should compute ease in out bounce", () => {
|
|
618
|
+
const result = math.ease({ x: 0.99, min: 0, max: 1, ease: Inputs.Math.easeEnum.easeInOutBounce });
|
|
619
|
+
expect(result).toEqual(0.9946375000000001);
|
|
620
|
+
});
|
|
621
|
+
});
|
|
622
|
+
|