@limitlesspc/std 0.21.1 → 0.23.0
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/array.d.ts +21 -4
- package/dist/array.js +5 -4
- package/dist/async/index.d.ts +1 -1
- package/dist/async/index.js +1 -13
- package/dist/{chunk-65SNM7MP.js → chunk-4POIKW4G.js} +9 -13
- package/dist/{chunk-WBSY6KRH.js → chunk-CCBSTDYA.js} +1 -1
- package/dist/{chunk-WNQNVZFS.js → chunk-ONMV3ICF.js} +219 -282
- package/dist/{chunk-O3YCU3KN.js → chunk-SSSOLDLG.js} +2 -2
- package/dist/cmath/index.js +1 -1
- package/dist/events.js +5 -6
- package/dist/fn/index.d.ts +14 -1
- package/dist/fn/index.js +1 -2
- package/dist/gfx/index.d.ts +1 -1
- package/dist/gfx/index.js +5 -6
- package/dist/iter/index.js +2 -3
- package/dist/math/index.d.ts +58 -58
- package/dist/math/index.js +7 -14
- package/dist/random.js +4 -5
- package/dist/string/index.js +5 -3
- package/dist/structs/index.d.ts +2 -75
- package/dist/structs/index.js +232 -18
- package/dist/types.js +0 -1
- package/dist/{vec3-S_YuL-W1.d.ts → vec3-BQ6mZ-wg.d.ts} +14 -24
- package/package.json +46 -50
- package/dist/chunk-6F4PWJZI.js +0 -0
- package/dist/chunk-DYKZK6B5.js +0 -523
- package/dist/easing.d.ts +0 -37
- package/dist/easing.js +0 -157
- /package/dist/{chunk-MG5VQSTV.js → chunk-NXILTE26.js} +0 -0
package/dist/chunk-DYKZK6B5.js
DELETED
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
swap
|
|
3
|
-
} from "./chunk-65SNM7MP.js";
|
|
4
|
-
import {
|
|
5
|
-
ascend,
|
|
6
|
-
descend
|
|
7
|
-
} from "./chunk-TMLWLR46.js";
|
|
8
|
-
|
|
9
|
-
// src/structs/doubly-linked-list.ts
|
|
10
|
-
var DoublyLinkedList = class _DoublyLinkedList {
|
|
11
|
-
head;
|
|
12
|
-
tail;
|
|
13
|
-
size = 0;
|
|
14
|
-
static from(values) {
|
|
15
|
-
const list = new _DoublyLinkedList();
|
|
16
|
-
for (const value of values) {
|
|
17
|
-
list.push(value);
|
|
18
|
-
}
|
|
19
|
-
return list;
|
|
20
|
-
}
|
|
21
|
-
get length() {
|
|
22
|
-
return this.size;
|
|
23
|
-
}
|
|
24
|
-
*[Symbol.iterator]() {
|
|
25
|
-
let current = this.head;
|
|
26
|
-
while (current) {
|
|
27
|
-
yield current.value;
|
|
28
|
-
current = current.next;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
getNode(index) {
|
|
32
|
-
let current = this.head;
|
|
33
|
-
let i = 0;
|
|
34
|
-
while (current) {
|
|
35
|
-
if (i === index) {
|
|
36
|
-
return current;
|
|
37
|
-
}
|
|
38
|
-
current = current.next;
|
|
39
|
-
i++;
|
|
40
|
-
}
|
|
41
|
-
return void 0;
|
|
42
|
-
}
|
|
43
|
-
get(index) {
|
|
44
|
-
return this.getNode(index)?.value;
|
|
45
|
-
}
|
|
46
|
-
set(index, value) {
|
|
47
|
-
const node = this.getNode(index);
|
|
48
|
-
if (!node) {
|
|
49
|
-
return void 0;
|
|
50
|
-
}
|
|
51
|
-
const { value: oldValue } = node;
|
|
52
|
-
node.value = value;
|
|
53
|
-
return oldValue;
|
|
54
|
-
}
|
|
55
|
-
push(value) {
|
|
56
|
-
const node = { value };
|
|
57
|
-
if (this.tail) {
|
|
58
|
-
this.tail.next = node;
|
|
59
|
-
this.tail = node;
|
|
60
|
-
} else {
|
|
61
|
-
this.head = node;
|
|
62
|
-
this.tail = node;
|
|
63
|
-
}
|
|
64
|
-
return ++this.size;
|
|
65
|
-
}
|
|
66
|
-
pop() {
|
|
67
|
-
if (!this.tail) {
|
|
68
|
-
return void 0;
|
|
69
|
-
}
|
|
70
|
-
const { value } = this.tail;
|
|
71
|
-
this.tail = this.tail.prev;
|
|
72
|
-
if (!this.tail) {
|
|
73
|
-
this.head = void 0;
|
|
74
|
-
}
|
|
75
|
-
this.size--;
|
|
76
|
-
return value;
|
|
77
|
-
}
|
|
78
|
-
unshift(value) {
|
|
79
|
-
const node = { value };
|
|
80
|
-
if (this.head) {
|
|
81
|
-
this.head.prev = node;
|
|
82
|
-
this.head = node;
|
|
83
|
-
} else {
|
|
84
|
-
this.head = node;
|
|
85
|
-
this.tail = node;
|
|
86
|
-
}
|
|
87
|
-
return ++this.size;
|
|
88
|
-
}
|
|
89
|
-
shift() {
|
|
90
|
-
if (!this.head) {
|
|
91
|
-
return void 0;
|
|
92
|
-
}
|
|
93
|
-
const { value } = this.head;
|
|
94
|
-
this.head = this.head.next;
|
|
95
|
-
if (!this.head) {
|
|
96
|
-
this.tail = void 0;
|
|
97
|
-
}
|
|
98
|
-
this.size--;
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
reverse() {
|
|
102
|
-
let current = this.head;
|
|
103
|
-
let previous;
|
|
104
|
-
let next;
|
|
105
|
-
while (current) {
|
|
106
|
-
({ next } = current);
|
|
107
|
-
current.next = previous;
|
|
108
|
-
current.prev = next;
|
|
109
|
-
previous = current;
|
|
110
|
-
current = next;
|
|
111
|
-
}
|
|
112
|
-
this.tail = this.head;
|
|
113
|
-
this.head = previous;
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
remove(index) {
|
|
117
|
-
const node = this.getNode(index);
|
|
118
|
-
if (!node) {
|
|
119
|
-
return void 0;
|
|
120
|
-
}
|
|
121
|
-
if (node.prev) {
|
|
122
|
-
node.prev.next = node.next;
|
|
123
|
-
}
|
|
124
|
-
if (node.next) {
|
|
125
|
-
node.next.prev = node.prev;
|
|
126
|
-
}
|
|
127
|
-
if (node === this.head) {
|
|
128
|
-
this.head = node.next;
|
|
129
|
-
}
|
|
130
|
-
if (node === this.tail) {
|
|
131
|
-
this.tail = node.prev;
|
|
132
|
-
}
|
|
133
|
-
this.size--;
|
|
134
|
-
return node.value;
|
|
135
|
-
}
|
|
136
|
-
splice(index, count, ...values) {
|
|
137
|
-
const removed = [];
|
|
138
|
-
for (let i = 0; i < count; i++) {
|
|
139
|
-
const value = this.remove(index);
|
|
140
|
-
if (value) {
|
|
141
|
-
removed.push(value);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
for (const value of values) {
|
|
145
|
-
this.set(index, value);
|
|
146
|
-
}
|
|
147
|
-
return removed;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// src/structs/heaps/heap.ts
|
|
152
|
-
var Heap = class _Heap {
|
|
153
|
-
constructor(compare, data = [], heapify = true) {
|
|
154
|
-
this.compare = compare;
|
|
155
|
-
if (heapify) {
|
|
156
|
-
this.data = [];
|
|
157
|
-
this.push(...data);
|
|
158
|
-
} else {
|
|
159
|
-
this.data = data;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
data;
|
|
163
|
-
get length() {
|
|
164
|
-
return this.data.length;
|
|
165
|
-
}
|
|
166
|
-
get height() {
|
|
167
|
-
return Math.floor(Math.log2(this.length)) + 1;
|
|
168
|
-
}
|
|
169
|
-
valueOf() {
|
|
170
|
-
return this.peek();
|
|
171
|
-
}
|
|
172
|
-
copy() {
|
|
173
|
-
return new _Heap(this.compare, [...this.data], false);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Returns the first value in the heap
|
|
177
|
-
*/
|
|
178
|
-
peek() {
|
|
179
|
-
return this.data[0];
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Removes the first value from the heap and returns it
|
|
183
|
-
*/
|
|
184
|
-
pop() {
|
|
185
|
-
const first = this.data[0];
|
|
186
|
-
swap(this.data, 0, this.length - 1);
|
|
187
|
-
this.data.pop();
|
|
188
|
-
this.heapify();
|
|
189
|
-
return first;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Inserts values into the heap and makes sure the first value is the min/max
|
|
193
|
-
* @param values
|
|
194
|
-
* @returns The new length of the heap
|
|
195
|
-
*/
|
|
196
|
-
push(...values) {
|
|
197
|
-
const { data, compare } = this;
|
|
198
|
-
for (const value of values) {
|
|
199
|
-
data.push(value);
|
|
200
|
-
let i = data.length - 1;
|
|
201
|
-
let parent = Math.floor((i - 1) / 2);
|
|
202
|
-
while (i > 0 && compare(data[i], data[parent]) < 0) {
|
|
203
|
-
swap(data, i, parent);
|
|
204
|
-
i = parent;
|
|
205
|
-
parent = Math.floor((i - 1) / 2);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return data.length;
|
|
209
|
-
}
|
|
210
|
-
*drain() {
|
|
211
|
-
while (this.length) {
|
|
212
|
-
yield this.pop();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
[Symbol.iterator]() {
|
|
216
|
-
return this.data.values();
|
|
217
|
-
}
|
|
218
|
-
heapify(i = 0) {
|
|
219
|
-
const { length, compare, data } = this;
|
|
220
|
-
const left = 2 * i + 1;
|
|
221
|
-
const right = 2 * i + 2;
|
|
222
|
-
let largest = i;
|
|
223
|
-
if (left < length && compare(data[left], data[largest]) < 0) {
|
|
224
|
-
largest = left;
|
|
225
|
-
}
|
|
226
|
-
if (right < length && compare(data[right], data[largest]) < 0) {
|
|
227
|
-
largest = right;
|
|
228
|
-
}
|
|
229
|
-
if (largest !== i) {
|
|
230
|
-
swap(data, i, largest);
|
|
231
|
-
this.heapify(largest);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// src/structs/heaps/max-heap.ts
|
|
237
|
-
var MaxHeap = class _MaxHeap extends Heap {
|
|
238
|
-
constructor(data, heapify) {
|
|
239
|
-
super(descend, data, heapify);
|
|
240
|
-
}
|
|
241
|
-
copy() {
|
|
242
|
-
return new _MaxHeap([...this.data], false);
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
// src/structs/heaps/min-heap.ts
|
|
247
|
-
var MinHeap = class _MinHeap extends Heap {
|
|
248
|
-
constructor(data, heapify) {
|
|
249
|
-
super(ascend, data, heapify);
|
|
250
|
-
}
|
|
251
|
-
copy() {
|
|
252
|
-
return new _MinHeap([...this.data], false);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// src/structs/linked-list.ts
|
|
257
|
-
var LinkedList = class _LinkedList {
|
|
258
|
-
node;
|
|
259
|
-
static from(values) {
|
|
260
|
-
const list = new _LinkedList();
|
|
261
|
-
let node;
|
|
262
|
-
for (const value of values) {
|
|
263
|
-
const child = { value };
|
|
264
|
-
if (node) {
|
|
265
|
-
node.next = child;
|
|
266
|
-
}
|
|
267
|
-
node = child;
|
|
268
|
-
}
|
|
269
|
-
list.node = node;
|
|
270
|
-
return list;
|
|
271
|
-
}
|
|
272
|
-
get length() {
|
|
273
|
-
let { node } = this;
|
|
274
|
-
let length = 0;
|
|
275
|
-
while (node) {
|
|
276
|
-
length++;
|
|
277
|
-
node = node.next;
|
|
278
|
-
}
|
|
279
|
-
return length;
|
|
280
|
-
}
|
|
281
|
-
*[Symbol.iterator]() {
|
|
282
|
-
let { node } = this;
|
|
283
|
-
while (node) {
|
|
284
|
-
yield node.value;
|
|
285
|
-
node = node.next;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
get tail() {
|
|
289
|
-
let { node } = this;
|
|
290
|
-
while (node) {
|
|
291
|
-
node = node.next;
|
|
292
|
-
}
|
|
293
|
-
return node;
|
|
294
|
-
}
|
|
295
|
-
getNode(index) {
|
|
296
|
-
let current = this.node;
|
|
297
|
-
let i = 0;
|
|
298
|
-
while (current) {
|
|
299
|
-
if (i === index) {
|
|
300
|
-
return current;
|
|
301
|
-
}
|
|
302
|
-
current = current.next;
|
|
303
|
-
i++;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
get(index) {
|
|
307
|
-
return this.getNode(index)?.value;
|
|
308
|
-
}
|
|
309
|
-
set(index, value) {
|
|
310
|
-
const node = this.getNode(index);
|
|
311
|
-
if (!node) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
const { value: oldValue } = node;
|
|
315
|
-
node.value = value;
|
|
316
|
-
return oldValue;
|
|
317
|
-
}
|
|
318
|
-
push(value) {
|
|
319
|
-
const { tail } = this;
|
|
320
|
-
const node = { value };
|
|
321
|
-
if (tail) {
|
|
322
|
-
tail.next = node;
|
|
323
|
-
} else {
|
|
324
|
-
this.node = node;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
pop() {
|
|
328
|
-
let current = this.node;
|
|
329
|
-
let parent;
|
|
330
|
-
while (current) {
|
|
331
|
-
if (!current.next) {
|
|
332
|
-
delete parent?.next;
|
|
333
|
-
return current;
|
|
334
|
-
}
|
|
335
|
-
parent = current;
|
|
336
|
-
current = current.next;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
unshift(value) {
|
|
340
|
-
const node = { value };
|
|
341
|
-
if (this.node) {
|
|
342
|
-
node.next = this.node;
|
|
343
|
-
this.node = node;
|
|
344
|
-
}
|
|
345
|
-
this.node = node;
|
|
346
|
-
}
|
|
347
|
-
shift() {
|
|
348
|
-
const { node } = this;
|
|
349
|
-
this.node = node?.next;
|
|
350
|
-
return node;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
// src/structs/queue.ts
|
|
355
|
-
var Queue = class {
|
|
356
|
-
constructor(items = []) {
|
|
357
|
-
this.items = items;
|
|
358
|
-
}
|
|
359
|
-
get size() {
|
|
360
|
-
return this.items.length;
|
|
361
|
-
}
|
|
362
|
-
enqueue(item) {
|
|
363
|
-
return this.items.push(item);
|
|
364
|
-
}
|
|
365
|
-
dequeue() {
|
|
366
|
-
return this.items.shift();
|
|
367
|
-
}
|
|
368
|
-
*[Symbol.iterator]() {
|
|
369
|
-
let item;
|
|
370
|
-
while (item = this.dequeue()) {
|
|
371
|
-
yield item;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
// src/structs/sorted-array.ts
|
|
377
|
-
var SortedArray = class _SortedArray {
|
|
378
|
-
constructor(data = [], compare = ascend, sort = true) {
|
|
379
|
-
this.data = data;
|
|
380
|
-
this.compare = compare;
|
|
381
|
-
if (sort) {
|
|
382
|
-
this.data.sort(compare);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
valueOf() {
|
|
386
|
-
return this.at(0);
|
|
387
|
-
}
|
|
388
|
-
keys() {
|
|
389
|
-
return this.data.keys();
|
|
390
|
-
}
|
|
391
|
-
values() {
|
|
392
|
-
return this.data.values();
|
|
393
|
-
}
|
|
394
|
-
entries() {
|
|
395
|
-
return this.data.entries();
|
|
396
|
-
}
|
|
397
|
-
[Symbol.iterator]() {
|
|
398
|
-
return this.values();
|
|
399
|
-
}
|
|
400
|
-
length() {
|
|
401
|
-
return this.data.length;
|
|
402
|
-
}
|
|
403
|
-
at(index) {
|
|
404
|
-
return this.data[index];
|
|
405
|
-
}
|
|
406
|
-
copy() {
|
|
407
|
-
return new _SortedArray([...this.data], this.compare, false);
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Returns the index of the value if it exists, otherwise -1
|
|
411
|
-
* @param value
|
|
412
|
-
*/
|
|
413
|
-
indexOf(value) {
|
|
414
|
-
const { data } = this;
|
|
415
|
-
let low = 0;
|
|
416
|
-
let high = data.length - 1;
|
|
417
|
-
while (low <= high) {
|
|
418
|
-
const mid = Math.floor((low + high) / 2);
|
|
419
|
-
const cmp = this.compare(value, data[mid]);
|
|
420
|
-
if (cmp < 0) {
|
|
421
|
-
high = mid - 1;
|
|
422
|
-
} else if (cmp > 0) {
|
|
423
|
-
low = mid + 1;
|
|
424
|
-
} else {
|
|
425
|
-
return mid;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return -1;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Returns if the array has the value
|
|
432
|
-
* @param value
|
|
433
|
-
*/
|
|
434
|
-
has(value) {
|
|
435
|
-
return this.data.includes(value);
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Binary inserts a value into the array while maintaining sorted order
|
|
439
|
-
* @param value
|
|
440
|
-
* @returns the index of where the value was inserted
|
|
441
|
-
*/
|
|
442
|
-
push(value) {
|
|
443
|
-
const { data, compare } = this;
|
|
444
|
-
let low = 0;
|
|
445
|
-
let high = data.length - 1;
|
|
446
|
-
while (low <= high) {
|
|
447
|
-
const mid = Math.floor((low + high) / 2);
|
|
448
|
-
const cmp = compare(value, data[mid]);
|
|
449
|
-
if (cmp < 0) {
|
|
450
|
-
high = mid - 1;
|
|
451
|
-
} else if (cmp > 0) {
|
|
452
|
-
low = mid + 1;
|
|
453
|
-
} else {
|
|
454
|
-
data.splice(mid, 0, value);
|
|
455
|
-
return mid;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
data.splice(low, 0, value);
|
|
459
|
-
return low;
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
// src/structs/unordered-array.ts
|
|
464
|
-
var UnorderedArray = class _UnorderedArray extends Array {
|
|
465
|
-
copy() {
|
|
466
|
-
return new _UnorderedArray(...this);
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Inserts new elements at the end of an unordered array, and returns the new length of the unordered array.
|
|
470
|
-
* @param items Elements to insert at the end of the array.
|
|
471
|
-
*/
|
|
472
|
-
unshift(...items) {
|
|
473
|
-
return super.push(...items);
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Removes the last element from an array and returns it.
|
|
477
|
-
* If the array is empty, undefined is returned and the array is not modified.
|
|
478
|
-
*/
|
|
479
|
-
shift() {
|
|
480
|
-
return super.pop();
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Removes an item by index
|
|
484
|
-
* @param index the index of the item to remove
|
|
485
|
-
* @returns the removed item, if it exists
|
|
486
|
-
*/
|
|
487
|
-
removeIndex(index) {
|
|
488
|
-
swap(this, index, this.length - 1);
|
|
489
|
-
return this.pop();
|
|
490
|
-
}
|
|
491
|
-
splice(start, deleteCount = this.length - start, ...items) {
|
|
492
|
-
const spliced = [];
|
|
493
|
-
for (let i = 0; i < deleteCount; i++) {
|
|
494
|
-
const replacement = items[i];
|
|
495
|
-
let removed;
|
|
496
|
-
if (replacement) {
|
|
497
|
-
removed = this[start + i];
|
|
498
|
-
this[start + i] = replacement;
|
|
499
|
-
} else {
|
|
500
|
-
removed = this.removeIndex(start);
|
|
501
|
-
}
|
|
502
|
-
if (removed) {
|
|
503
|
-
spliced.push(removed);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return spliced;
|
|
507
|
-
}
|
|
508
|
-
toSpliced(start, deleteCount = this.length - start, ...items) {
|
|
509
|
-
const copy = this.copy();
|
|
510
|
-
copy.splice(start, deleteCount, ...items);
|
|
511
|
-
return copy;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
|
|
515
|
-
export {
|
|
516
|
-
DoublyLinkedList,
|
|
517
|
-
MaxHeap,
|
|
518
|
-
MinHeap,
|
|
519
|
-
LinkedList,
|
|
520
|
-
Queue,
|
|
521
|
-
SortedArray,
|
|
522
|
-
UnorderedArray
|
|
523
|
-
};
|
package/dist/easing.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module
|
|
3
|
-
* Easing functions
|
|
4
|
-
*/
|
|
5
|
-
declare function linear(t: number): number;
|
|
6
|
-
declare function easeInQuad(t: number): number;
|
|
7
|
-
declare function easeOutQuad(t: number): number;
|
|
8
|
-
declare function easeInOutQuad(t: number): number;
|
|
9
|
-
declare function easeInCubic(t: number): number;
|
|
10
|
-
declare function easeOutCubic(t: number): number;
|
|
11
|
-
declare function easeInOutCubic(t: number): number;
|
|
12
|
-
declare function easeInQuart(t: number): number;
|
|
13
|
-
declare function easeOutQuart(t: number): number;
|
|
14
|
-
declare function easeInOutQuart(t: number): number;
|
|
15
|
-
declare function easeInQuint(t: number): number;
|
|
16
|
-
declare function easeOutQuint(t: number): number;
|
|
17
|
-
declare function easeInOutQuint(t: number): number;
|
|
18
|
-
declare function easeInSine(t: number): number;
|
|
19
|
-
declare function easeOutSine(t: number): number;
|
|
20
|
-
declare function easeInOutSine(t: number): number;
|
|
21
|
-
declare function easeInExpo(t: number): number;
|
|
22
|
-
declare function easeOutExpo(t: number): number;
|
|
23
|
-
declare function easeInOutExpo(t: number): number;
|
|
24
|
-
declare function easeInCirc(t: number): number;
|
|
25
|
-
declare function easeOutCirc(t: number): number;
|
|
26
|
-
declare function easeInOutCirc(t: number): number;
|
|
27
|
-
declare function easeInElastic(t: number): number;
|
|
28
|
-
declare function easeOutElastic(t: number): number;
|
|
29
|
-
declare function easeInOutElastic(t: number): number;
|
|
30
|
-
declare function easeInBack(t: number): number;
|
|
31
|
-
declare function easeOutBack(t: number): number;
|
|
32
|
-
declare function easeInOutBack(t: number): number;
|
|
33
|
-
declare function easeInBounce(t: number): number;
|
|
34
|
-
declare function easeOutBounce(t: number): number;
|
|
35
|
-
declare function easeInOutBounce(t: number): number;
|
|
36
|
-
|
|
37
|
-
export { easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, linear };
|
package/dist/easing.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
// src/easing.ts
|
|
2
|
-
function linear(t) {
|
|
3
|
-
return t;
|
|
4
|
-
}
|
|
5
|
-
function easeInQuad(t) {
|
|
6
|
-
return t * t;
|
|
7
|
-
}
|
|
8
|
-
function easeOutQuad(t) {
|
|
9
|
-
return t * (2 - t);
|
|
10
|
-
}
|
|
11
|
-
function easeInOutQuad(t) {
|
|
12
|
-
const t2 = 2 * t;
|
|
13
|
-
return t < 0.5 ? t2 * t : -1 + (4 - t2) * t;
|
|
14
|
-
}
|
|
15
|
-
function easeInCubic(t) {
|
|
16
|
-
return t * t * t;
|
|
17
|
-
}
|
|
18
|
-
function easeOutCubic(t) {
|
|
19
|
-
return 1 + --t * t * t;
|
|
20
|
-
}
|
|
21
|
-
function easeInOutCubic(t) {
|
|
22
|
-
const a = 2 * t - 2;
|
|
23
|
-
return t < 0.5 ? 4 * t * t * t : (t - 1) * a * a + 1;
|
|
24
|
-
}
|
|
25
|
-
function easeInQuart(t) {
|
|
26
|
-
const tt = t * t;
|
|
27
|
-
return tt * tt;
|
|
28
|
-
}
|
|
29
|
-
function easeOutQuart(t) {
|
|
30
|
-
const tt = --t * t;
|
|
31
|
-
return 1 - tt * tt;
|
|
32
|
-
}
|
|
33
|
-
function easeInOutQuart(t) {
|
|
34
|
-
const firstHalf = t < 0.5;
|
|
35
|
-
const tt = t * t;
|
|
36
|
-
const a = --t * t;
|
|
37
|
-
return firstHalf ? 8 * tt * tt : 1 - 8 * a * a;
|
|
38
|
-
}
|
|
39
|
-
function easeInQuint(t) {
|
|
40
|
-
const tt = t * t;
|
|
41
|
-
return tt * tt * t;
|
|
42
|
-
}
|
|
43
|
-
function easeOutQuint(t) {
|
|
44
|
-
const tt = --t * t;
|
|
45
|
-
return 1 + tt * tt * t;
|
|
46
|
-
}
|
|
47
|
-
function easeInOutQuint(t) {
|
|
48
|
-
const firstHalf = t < 0.5;
|
|
49
|
-
const tt = t * t;
|
|
50
|
-
const a = --t * t;
|
|
51
|
-
return firstHalf ? 16 * tt * tt * t : 1 + 16 * a * a * t;
|
|
52
|
-
}
|
|
53
|
-
function easeInSine(t) {
|
|
54
|
-
return 1 - Math.cos(t * Math.PI / 2);
|
|
55
|
-
}
|
|
56
|
-
function easeOutSine(t) {
|
|
57
|
-
return Math.sin(t * Math.PI / 2);
|
|
58
|
-
}
|
|
59
|
-
function easeInOutSine(t) {
|
|
60
|
-
return -(Math.cos(t * Math.PI) - 1) / 2;
|
|
61
|
-
}
|
|
62
|
-
function easeInExpo(t) {
|
|
63
|
-
return t === 0 ? 0 : 2 ** (10 * (t - 1));
|
|
64
|
-
}
|
|
65
|
-
function easeOutExpo(t) {
|
|
66
|
-
return t === 1 ? 1 : -(2 ** (-10 * t)) + 1;
|
|
67
|
-
}
|
|
68
|
-
function easeInOutExpo(t) {
|
|
69
|
-
if (t === 0 || t === 1) {
|
|
70
|
-
return t;
|
|
71
|
-
}
|
|
72
|
-
return t < 0.5 ? 2 ** (20 * (t - 1)) / 2 : -(2 ** (-20 * t)) / 2 + 1;
|
|
73
|
-
}
|
|
74
|
-
function easeInCirc(t) {
|
|
75
|
-
return 1 - Math.sqrt(1 - t * t);
|
|
76
|
-
}
|
|
77
|
-
function easeOutCirc(t) {
|
|
78
|
-
return Math.sqrt(1 - --t * t);
|
|
79
|
-
}
|
|
80
|
-
function easeInOutCirc(t) {
|
|
81
|
-
return t < 0.5 ? (1 - Math.sqrt(1 - 2 * t)) / 2 : (Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
|
|
82
|
-
}
|
|
83
|
-
function easeInElastic(t) {
|
|
84
|
-
if (t === 0 || t === 1) {
|
|
85
|
-
return t;
|
|
86
|
-
}
|
|
87
|
-
return -(2 ** (10 * (t - 1))) * Math.sin((t - 1.1) * 5 * Math.PI);
|
|
88
|
-
}
|
|
89
|
-
function easeOutElastic(t) {
|
|
90
|
-
if (t === 0 || t === 1) {
|
|
91
|
-
return t;
|
|
92
|
-
}
|
|
93
|
-
return 2 ** (-10 * t) * Math.sin((t - 0.1) * 5 * Math.PI) + 1;
|
|
94
|
-
}
|
|
95
|
-
function easeInOutElastic(t) {
|
|
96
|
-
if (t === 0 || t === 1) {
|
|
97
|
-
return t;
|
|
98
|
-
}
|
|
99
|
-
return t < 0.5 ? -(2 ** (20 * (t - 1)) * Math.sin((t - 1.1) * 5 * Math.PI)) / 2 : 2 ** (-20 * t) * Math.sin((t - 1.1) * 5 * Math.PI) / 2 + 1;
|
|
100
|
-
}
|
|
101
|
-
function easeInBack(t) {
|
|
102
|
-
return t * t * (2.70158 * t - 1.70158);
|
|
103
|
-
}
|
|
104
|
-
function easeOutBack(t) {
|
|
105
|
-
return --t * t * (2.70158 * t + 1.70158) + 1;
|
|
106
|
-
}
|
|
107
|
-
function easeInOutBack(t) {
|
|
108
|
-
return t < 0.5 ? (2.70158 * t * t * t + 2) / 2 : (1.70158 * (t - 1) * (t - 1) * (t - 1) + 2) / 2;
|
|
109
|
-
}
|
|
110
|
-
function easeInBounce(t) {
|
|
111
|
-
return 1 - easeOutBounce(1 - t);
|
|
112
|
-
}
|
|
113
|
-
function easeOutBounce(t) {
|
|
114
|
-
if (t < 1 / 2.75) {
|
|
115
|
-
return 7.5625 * t * t;
|
|
116
|
-
}
|
|
117
|
-
if (t < 2 / 2.75) {
|
|
118
|
-
return 7.5625 * (t -= 1.5 / 2.75) * t + 0.75;
|
|
119
|
-
}
|
|
120
|
-
return t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375 : 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
|
|
121
|
-
}
|
|
122
|
-
function easeInOutBounce(t) {
|
|
123
|
-
return t < 0.5 ? (1 - easeOutBounce(1 - t * 2)) / 2 : (easeOutBounce(t * 2 - 1) + 1) / 2;
|
|
124
|
-
}
|
|
125
|
-
export {
|
|
126
|
-
easeInBack,
|
|
127
|
-
easeInBounce,
|
|
128
|
-
easeInCirc,
|
|
129
|
-
easeInCubic,
|
|
130
|
-
easeInElastic,
|
|
131
|
-
easeInExpo,
|
|
132
|
-
easeInOutBack,
|
|
133
|
-
easeInOutBounce,
|
|
134
|
-
easeInOutCirc,
|
|
135
|
-
easeInOutCubic,
|
|
136
|
-
easeInOutElastic,
|
|
137
|
-
easeInOutExpo,
|
|
138
|
-
easeInOutQuad,
|
|
139
|
-
easeInOutQuart,
|
|
140
|
-
easeInOutQuint,
|
|
141
|
-
easeInOutSine,
|
|
142
|
-
easeInQuad,
|
|
143
|
-
easeInQuart,
|
|
144
|
-
easeInQuint,
|
|
145
|
-
easeInSine,
|
|
146
|
-
easeOutBack,
|
|
147
|
-
easeOutBounce,
|
|
148
|
-
easeOutCirc,
|
|
149
|
-
easeOutCubic,
|
|
150
|
-
easeOutElastic,
|
|
151
|
-
easeOutExpo,
|
|
152
|
-
easeOutQuad,
|
|
153
|
-
easeOutQuart,
|
|
154
|
-
easeOutQuint,
|
|
155
|
-
easeOutSine,
|
|
156
|
-
linear
|
|
157
|
-
};
|
|
File without changes
|