coily 0.7.3 → 0.8.1
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/api.cjs +40 -20
- package/dist/api.d.cts +2 -2
- package/dist/api.d.mts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.mjs +40 -20
- package/dist/loop.d.cts +1 -1
- package/dist/loop.d.mts +1 -1
- package/dist/loop.d.ts +1 -1
- package/dist/shared/{coily.7c365057.d.cts → coily.fc8a32a3.d.cts} +6 -3
- package/dist/shared/{coily.7c365057.d.mts → coily.fc8a32a3.d.mts} +6 -3
- package/dist/shared/{coily.7c365057.d.ts → coily.fc8a32a3.d.ts} +6 -3
- package/package.json +3 -5
package/dist/api.cjs
CHANGED
|
@@ -181,7 +181,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
181
181
|
__accessCheck$2(obj, member, "access private method");
|
|
182
182
|
return method;
|
|
183
183
|
};
|
|
184
|
-
var _mass, _tension, _damping, _state, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _needsUpdate, _needsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
|
|
184
|
+
var _mass, _tension, _damping, _state, _lazyPosition, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _needsUpdate, _needsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
|
|
185
185
|
class Solver {
|
|
186
186
|
constructor(options) {
|
|
187
187
|
__privateAdd$2(this, _updateSolver);
|
|
@@ -189,6 +189,7 @@ class Solver {
|
|
|
189
189
|
__privateAdd$2(this, _tension, void 0);
|
|
190
190
|
__privateAdd$2(this, _damping, void 0);
|
|
191
191
|
__privateAdd$2(this, _state, void 0);
|
|
192
|
+
__privateAdd$2(this, _lazyPosition, void 0);
|
|
192
193
|
__privateAdd$2(this, _underdampedSolver, null);
|
|
193
194
|
__privateAdd$2(this, _criticallyDampedSolver, null);
|
|
194
195
|
__privateAdd$2(this, _overdampedSolver, null);
|
|
@@ -204,6 +205,7 @@ class Solver {
|
|
|
204
205
|
options.velocity,
|
|
205
206
|
options.precision
|
|
206
207
|
));
|
|
208
|
+
__privateSet$2(this, _lazyPosition, options.position);
|
|
207
209
|
__privateSet$2(this, _emitter, new Emitter());
|
|
208
210
|
__privateMethod(this, _updateSolver, updateSolver_fn).call(this);
|
|
209
211
|
}
|
|
@@ -234,6 +236,12 @@ class Solver {
|
|
|
234
236
|
set position(value) {
|
|
235
237
|
__privateGet$2(this, _state).position = value;
|
|
236
238
|
__privateSet$2(this, _needsReset, true);
|
|
239
|
+
if (!__privateGet$2(this, _state).resting) {
|
|
240
|
+
__privateGet$2(this, _emitter).emit("start");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
get lazyPosition() {
|
|
244
|
+
return __privateGet$2(this, _lazyPosition);
|
|
237
245
|
}
|
|
238
246
|
get velocity() {
|
|
239
247
|
return __privateGet$2(this, _state).velocity;
|
|
@@ -260,7 +268,7 @@ class Solver {
|
|
|
260
268
|
get dampingRatio() {
|
|
261
269
|
return __privateGet$2(this, _damping) / this.criticalDamping;
|
|
262
270
|
}
|
|
263
|
-
tick(dt) {
|
|
271
|
+
tick(dt, emit = true) {
|
|
264
272
|
if (__privateGet$2(this, _needsUpdate)) {
|
|
265
273
|
__privateMethod(this, _updateSolver, updateSolver_fn).call(this);
|
|
266
274
|
__privateSet$2(this, _needsUpdate, false);
|
|
@@ -269,28 +277,30 @@ class Solver {
|
|
|
269
277
|
__privateGet$2(this, _currentSolver).reset();
|
|
270
278
|
__privateSet$2(this, _needsReset, false);
|
|
271
279
|
}
|
|
272
|
-
const previousPosition = __privateGet$2(this, _state).position;
|
|
273
|
-
const previousVelocity = __privateGet$2(this, _state).velocity;
|
|
274
|
-
const previousResting = __privateGet$2(this, _state).resting;
|
|
275
280
|
__privateGet$2(this, _currentSolver).tick(dt);
|
|
276
|
-
|
|
281
|
+
__privateSet$2(this, _lazyPosition, __privateGet$2(this, _state).position);
|
|
282
|
+
if (emit) {
|
|
277
283
|
__privateGet$2(this, _emitter).emit("update");
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
284
|
+
if (__privateGet$2(this, _state).resting) {
|
|
285
|
+
__privateGet$2(this, _emitter).emit("stop");
|
|
286
|
+
}
|
|
281
287
|
}
|
|
282
288
|
}
|
|
283
289
|
onUpdate(callback) {
|
|
284
290
|
return __privateGet$2(this, _emitter).on("update", callback);
|
|
285
291
|
}
|
|
286
|
-
|
|
287
|
-
return __privateGet$2(this, _emitter).on("
|
|
292
|
+
onStart(callback) {
|
|
293
|
+
return __privateGet$2(this, _emitter).on("start", callback);
|
|
294
|
+
}
|
|
295
|
+
onStop(callback) {
|
|
296
|
+
return __privateGet$2(this, _emitter).on("stop", callback);
|
|
288
297
|
}
|
|
289
298
|
}
|
|
290
299
|
_mass = new WeakMap();
|
|
291
300
|
_tension = new WeakMap();
|
|
292
301
|
_damping = new WeakMap();
|
|
293
302
|
_state = new WeakMap();
|
|
303
|
+
_lazyPosition = new WeakMap();
|
|
294
304
|
_underdampedSolver = new WeakMap();
|
|
295
305
|
_criticallyDampedSolver = new WeakMap();
|
|
296
306
|
_overdampedSolver = new WeakMap();
|
|
@@ -443,13 +453,13 @@ var __privateSet$1 = (obj, member, value, setter) => {
|
|
|
443
453
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
444
454
|
return value;
|
|
445
455
|
};
|
|
446
|
-
var _target, _solver, _scheduler$1
|
|
456
|
+
var _target, _solver, _scheduler$1;
|
|
447
457
|
class Spring {
|
|
458
|
+
// #newTarget: number
|
|
448
459
|
constructor(scheduler, options) {
|
|
449
460
|
__privateAdd$1(this, _target, void 0);
|
|
450
461
|
__privateAdd$1(this, _solver, void 0);
|
|
451
462
|
__privateAdd$1(this, _scheduler$1, void 0);
|
|
452
|
-
__privateAdd$1(this, _newTarget, void 0);
|
|
453
463
|
invariant(options.mass > 0, "Mass must be greater than 0");
|
|
454
464
|
invariant(options.tension > 0, "Tension must be greater than 0");
|
|
455
465
|
invariant(
|
|
@@ -470,7 +480,6 @@ class Spring {
|
|
|
470
480
|
precision: options.precision ?? 2
|
|
471
481
|
}));
|
|
472
482
|
__privateSet$1(this, _scheduler$1, scheduler);
|
|
473
|
-
__privateSet$1(this, _newTarget, __privateGet$1(this, _target));
|
|
474
483
|
if (!__privateGet$1(this, _solver).resting) {
|
|
475
484
|
__privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
|
|
476
485
|
}
|
|
@@ -480,6 +489,9 @@ class Spring {
|
|
|
480
489
|
}
|
|
481
490
|
set target(value) {
|
|
482
491
|
if (value !== __privateGet$1(this, _target)) {
|
|
492
|
+
if (__privateGet$1(this, _solver).position !== __privateGet$1(this, _solver).lazyPosition) {
|
|
493
|
+
__privateGet$1(this, _solver).tick(0, false);
|
|
494
|
+
}
|
|
483
495
|
if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
|
|
484
496
|
__privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
|
|
485
497
|
}
|
|
@@ -492,10 +504,16 @@ class Spring {
|
|
|
492
504
|
return __privateGet$1(this, _target) + __privateGet$1(this, _solver).position;
|
|
493
505
|
}
|
|
494
506
|
set value(value) {
|
|
495
|
-
|
|
496
|
-
|
|
507
|
+
const position = value - __privateGet$1(this, _target);
|
|
508
|
+
if (position !== __privateGet$1(this, _solver).position) {
|
|
509
|
+
if (__privateGet$1(this, _solver).position !== __privateGet$1(this, _solver).lazyPosition) {
|
|
510
|
+
__privateGet$1(this, _solver).tick(0, false);
|
|
511
|
+
}
|
|
512
|
+
if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
|
|
513
|
+
__privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
|
|
514
|
+
}
|
|
515
|
+
__privateGet$1(this, _solver).position = position;
|
|
497
516
|
}
|
|
498
|
-
__privateGet$1(this, _solver).position = __privateGet$1(this, _target) - value;
|
|
499
517
|
}
|
|
500
518
|
get velocity() {
|
|
501
519
|
return __privateGet$1(this, _solver).velocity;
|
|
@@ -552,14 +570,16 @@ class Spring {
|
|
|
552
570
|
onUpdate(callback) {
|
|
553
571
|
return __privateGet$1(this, _solver).onUpdate(callback);
|
|
554
572
|
}
|
|
555
|
-
|
|
556
|
-
return __privateGet$1(this, _solver).
|
|
573
|
+
onStart(callback) {
|
|
574
|
+
return __privateGet$1(this, _solver).onStart(callback);
|
|
575
|
+
}
|
|
576
|
+
onStop(callback) {
|
|
577
|
+
return __privateGet$1(this, _solver).onStop(callback);
|
|
557
578
|
}
|
|
558
579
|
}
|
|
559
580
|
_target = new WeakMap();
|
|
560
581
|
_solver = new WeakMap();
|
|
561
582
|
_scheduler$1 = new WeakMap();
|
|
562
|
-
_newTarget = new WeakMap();
|
|
563
583
|
|
|
564
584
|
var __accessCheck = (obj, member, msg) => {
|
|
565
585
|
if (!member.has(obj))
|
package/dist/api.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SpringSystem } from './shared/coily.
|
|
2
|
-
export { a as Spring } from './shared/coily.
|
|
1
|
+
import { S as SpringSystem } from './shared/coily.fc8a32a3.cjs';
|
|
2
|
+
export { a as Spring } from './shared/coily.fc8a32a3.cjs';
|
|
3
3
|
|
|
4
4
|
declare function createSpringSystem(): SpringSystem;
|
|
5
5
|
|
package/dist/api.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SpringSystem } from './shared/coily.
|
|
2
|
-
export { a as Spring } from './shared/coily.
|
|
1
|
+
import { S as SpringSystem } from './shared/coily.fc8a32a3.mjs';
|
|
2
|
+
export { a as Spring } from './shared/coily.fc8a32a3.mjs';
|
|
3
3
|
|
|
4
4
|
declare function createSpringSystem(): SpringSystem;
|
|
5
5
|
|
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SpringSystem } from './shared/coily.
|
|
2
|
-
export { a as Spring } from './shared/coily.
|
|
1
|
+
import { S as SpringSystem } from './shared/coily.fc8a32a3.js';
|
|
2
|
+
export { a as Spring } from './shared/coily.fc8a32a3.js';
|
|
3
3
|
|
|
4
4
|
declare function createSpringSystem(): SpringSystem;
|
|
5
5
|
|
package/dist/api.mjs
CHANGED
|
@@ -179,7 +179,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
179
179
|
__accessCheck$2(obj, member, "access private method");
|
|
180
180
|
return method;
|
|
181
181
|
};
|
|
182
|
-
var _mass, _tension, _damping, _state, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _needsUpdate, _needsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
|
|
182
|
+
var _mass, _tension, _damping, _state, _lazyPosition, _underdampedSolver, _criticallyDampedSolver, _overdampedSolver, _currentSolver, _needsUpdate, _needsReset, _emitter, _updateSolver, updateSolver_fn, _solver$1, _state2, _dampedFrequency, _t, _c1, _c2, _solver2, _state3, _t2, _c12, _c22, _solver3, _state4, _dampedFrequency2, _t3, _c13, _c23;
|
|
183
183
|
class Solver {
|
|
184
184
|
constructor(options) {
|
|
185
185
|
__privateAdd$2(this, _updateSolver);
|
|
@@ -187,6 +187,7 @@ class Solver {
|
|
|
187
187
|
__privateAdd$2(this, _tension, void 0);
|
|
188
188
|
__privateAdd$2(this, _damping, void 0);
|
|
189
189
|
__privateAdd$2(this, _state, void 0);
|
|
190
|
+
__privateAdd$2(this, _lazyPosition, void 0);
|
|
190
191
|
__privateAdd$2(this, _underdampedSolver, null);
|
|
191
192
|
__privateAdd$2(this, _criticallyDampedSolver, null);
|
|
192
193
|
__privateAdd$2(this, _overdampedSolver, null);
|
|
@@ -202,6 +203,7 @@ class Solver {
|
|
|
202
203
|
options.velocity,
|
|
203
204
|
options.precision
|
|
204
205
|
));
|
|
206
|
+
__privateSet$2(this, _lazyPosition, options.position);
|
|
205
207
|
__privateSet$2(this, _emitter, new Emitter());
|
|
206
208
|
__privateMethod(this, _updateSolver, updateSolver_fn).call(this);
|
|
207
209
|
}
|
|
@@ -232,6 +234,12 @@ class Solver {
|
|
|
232
234
|
set position(value) {
|
|
233
235
|
__privateGet$2(this, _state).position = value;
|
|
234
236
|
__privateSet$2(this, _needsReset, true);
|
|
237
|
+
if (!__privateGet$2(this, _state).resting) {
|
|
238
|
+
__privateGet$2(this, _emitter).emit("start");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
get lazyPosition() {
|
|
242
|
+
return __privateGet$2(this, _lazyPosition);
|
|
235
243
|
}
|
|
236
244
|
get velocity() {
|
|
237
245
|
return __privateGet$2(this, _state).velocity;
|
|
@@ -258,7 +266,7 @@ class Solver {
|
|
|
258
266
|
get dampingRatio() {
|
|
259
267
|
return __privateGet$2(this, _damping) / this.criticalDamping;
|
|
260
268
|
}
|
|
261
|
-
tick(dt) {
|
|
269
|
+
tick(dt, emit = true) {
|
|
262
270
|
if (__privateGet$2(this, _needsUpdate)) {
|
|
263
271
|
__privateMethod(this, _updateSolver, updateSolver_fn).call(this);
|
|
264
272
|
__privateSet$2(this, _needsUpdate, false);
|
|
@@ -267,28 +275,30 @@ class Solver {
|
|
|
267
275
|
__privateGet$2(this, _currentSolver).reset();
|
|
268
276
|
__privateSet$2(this, _needsReset, false);
|
|
269
277
|
}
|
|
270
|
-
const previousPosition = __privateGet$2(this, _state).position;
|
|
271
|
-
const previousVelocity = __privateGet$2(this, _state).velocity;
|
|
272
|
-
const previousResting = __privateGet$2(this, _state).resting;
|
|
273
278
|
__privateGet$2(this, _currentSolver).tick(dt);
|
|
274
|
-
|
|
279
|
+
__privateSet$2(this, _lazyPosition, __privateGet$2(this, _state).position);
|
|
280
|
+
if (emit) {
|
|
275
281
|
__privateGet$2(this, _emitter).emit("update");
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
282
|
+
if (__privateGet$2(this, _state).resting) {
|
|
283
|
+
__privateGet$2(this, _emitter).emit("stop");
|
|
284
|
+
}
|
|
279
285
|
}
|
|
280
286
|
}
|
|
281
287
|
onUpdate(callback) {
|
|
282
288
|
return __privateGet$2(this, _emitter).on("update", callback);
|
|
283
289
|
}
|
|
284
|
-
|
|
285
|
-
return __privateGet$2(this, _emitter).on("
|
|
290
|
+
onStart(callback) {
|
|
291
|
+
return __privateGet$2(this, _emitter).on("start", callback);
|
|
292
|
+
}
|
|
293
|
+
onStop(callback) {
|
|
294
|
+
return __privateGet$2(this, _emitter).on("stop", callback);
|
|
286
295
|
}
|
|
287
296
|
}
|
|
288
297
|
_mass = new WeakMap();
|
|
289
298
|
_tension = new WeakMap();
|
|
290
299
|
_damping = new WeakMap();
|
|
291
300
|
_state = new WeakMap();
|
|
301
|
+
_lazyPosition = new WeakMap();
|
|
292
302
|
_underdampedSolver = new WeakMap();
|
|
293
303
|
_criticallyDampedSolver = new WeakMap();
|
|
294
304
|
_overdampedSolver = new WeakMap();
|
|
@@ -441,13 +451,13 @@ var __privateSet$1 = (obj, member, value, setter) => {
|
|
|
441
451
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
442
452
|
return value;
|
|
443
453
|
};
|
|
444
|
-
var _target, _solver, _scheduler$1
|
|
454
|
+
var _target, _solver, _scheduler$1;
|
|
445
455
|
class Spring {
|
|
456
|
+
// #newTarget: number
|
|
446
457
|
constructor(scheduler, options) {
|
|
447
458
|
__privateAdd$1(this, _target, void 0);
|
|
448
459
|
__privateAdd$1(this, _solver, void 0);
|
|
449
460
|
__privateAdd$1(this, _scheduler$1, void 0);
|
|
450
|
-
__privateAdd$1(this, _newTarget, void 0);
|
|
451
461
|
invariant(options.mass > 0, "Mass must be greater than 0");
|
|
452
462
|
invariant(options.tension > 0, "Tension must be greater than 0");
|
|
453
463
|
invariant(
|
|
@@ -468,7 +478,6 @@ class Spring {
|
|
|
468
478
|
precision: options.precision ?? 2
|
|
469
479
|
}));
|
|
470
480
|
__privateSet$1(this, _scheduler$1, scheduler);
|
|
471
|
-
__privateSet$1(this, _newTarget, __privateGet$1(this, _target));
|
|
472
481
|
if (!__privateGet$1(this, _solver).resting) {
|
|
473
482
|
__privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
|
|
474
483
|
}
|
|
@@ -478,6 +487,9 @@ class Spring {
|
|
|
478
487
|
}
|
|
479
488
|
set target(value) {
|
|
480
489
|
if (value !== __privateGet$1(this, _target)) {
|
|
490
|
+
if (__privateGet$1(this, _solver).position !== __privateGet$1(this, _solver).lazyPosition) {
|
|
491
|
+
__privateGet$1(this, _solver).tick(0, false);
|
|
492
|
+
}
|
|
481
493
|
if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
|
|
482
494
|
__privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
|
|
483
495
|
}
|
|
@@ -490,10 +502,16 @@ class Spring {
|
|
|
490
502
|
return __privateGet$1(this, _target) + __privateGet$1(this, _solver).position;
|
|
491
503
|
}
|
|
492
504
|
set value(value) {
|
|
493
|
-
|
|
494
|
-
|
|
505
|
+
const position = value - __privateGet$1(this, _target);
|
|
506
|
+
if (position !== __privateGet$1(this, _solver).position) {
|
|
507
|
+
if (__privateGet$1(this, _solver).position !== __privateGet$1(this, _solver).lazyPosition) {
|
|
508
|
+
__privateGet$1(this, _solver).tick(0, false);
|
|
509
|
+
}
|
|
510
|
+
if (!__privateGet$1(this, _scheduler$1).has(__privateGet$1(this, _solver))) {
|
|
511
|
+
__privateGet$1(this, _scheduler$1).add(__privateGet$1(this, _solver));
|
|
512
|
+
}
|
|
513
|
+
__privateGet$1(this, _solver).position = position;
|
|
495
514
|
}
|
|
496
|
-
__privateGet$1(this, _solver).position = __privateGet$1(this, _target) - value;
|
|
497
515
|
}
|
|
498
516
|
get velocity() {
|
|
499
517
|
return __privateGet$1(this, _solver).velocity;
|
|
@@ -550,14 +568,16 @@ class Spring {
|
|
|
550
568
|
onUpdate(callback) {
|
|
551
569
|
return __privateGet$1(this, _solver).onUpdate(callback);
|
|
552
570
|
}
|
|
553
|
-
|
|
554
|
-
return __privateGet$1(this, _solver).
|
|
571
|
+
onStart(callback) {
|
|
572
|
+
return __privateGet$1(this, _solver).onStart(callback);
|
|
573
|
+
}
|
|
574
|
+
onStop(callback) {
|
|
575
|
+
return __privateGet$1(this, _solver).onStop(callback);
|
|
555
576
|
}
|
|
556
577
|
}
|
|
557
578
|
_target = new WeakMap();
|
|
558
579
|
_solver = new WeakMap();
|
|
559
580
|
_scheduler$1 = new WeakMap();
|
|
560
|
-
_newTarget = new WeakMap();
|
|
561
581
|
|
|
562
582
|
var __accessCheck = (obj, member, msg) => {
|
|
563
583
|
if (!member.has(obj))
|
package/dist/loop.d.cts
CHANGED
package/dist/loop.d.mts
CHANGED
package/dist/loop.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare class Solver {
|
|
|
17
17
|
set damping(value: number);
|
|
18
18
|
get position(): number;
|
|
19
19
|
set position(value: number);
|
|
20
|
+
get lazyPosition(): number;
|
|
20
21
|
get velocity(): number;
|
|
21
22
|
set velocity(value: number);
|
|
22
23
|
get precision(): number;
|
|
@@ -25,9 +26,10 @@ declare class Solver {
|
|
|
25
26
|
get naturalFrequency(): number;
|
|
26
27
|
get criticalDamping(): number;
|
|
27
28
|
get dampingRatio(): number;
|
|
28
|
-
tick(dt: number): void;
|
|
29
|
+
tick(dt: number, emit?: boolean): void;
|
|
29
30
|
onUpdate(callback: () => void): () => void;
|
|
30
|
-
|
|
31
|
+
onStart(callback: () => void): () => void;
|
|
32
|
+
onStop(callback: () => void): () => void;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
declare class Scheduler {
|
|
@@ -65,7 +67,8 @@ declare class Spring {
|
|
|
65
67
|
set precision(value: number);
|
|
66
68
|
get resting(): boolean;
|
|
67
69
|
onUpdate(callback: () => void): () => void;
|
|
68
|
-
|
|
70
|
+
onStart(callback: () => void): () => void;
|
|
71
|
+
onStop(callback: () => void): () => void;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
interface SpringOptions {
|
|
@@ -17,6 +17,7 @@ declare class Solver {
|
|
|
17
17
|
set damping(value: number);
|
|
18
18
|
get position(): number;
|
|
19
19
|
set position(value: number);
|
|
20
|
+
get lazyPosition(): number;
|
|
20
21
|
get velocity(): number;
|
|
21
22
|
set velocity(value: number);
|
|
22
23
|
get precision(): number;
|
|
@@ -25,9 +26,10 @@ declare class Solver {
|
|
|
25
26
|
get naturalFrequency(): number;
|
|
26
27
|
get criticalDamping(): number;
|
|
27
28
|
get dampingRatio(): number;
|
|
28
|
-
tick(dt: number): void;
|
|
29
|
+
tick(dt: number, emit?: boolean): void;
|
|
29
30
|
onUpdate(callback: () => void): () => void;
|
|
30
|
-
|
|
31
|
+
onStart(callback: () => void): () => void;
|
|
32
|
+
onStop(callback: () => void): () => void;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
declare class Scheduler {
|
|
@@ -65,7 +67,8 @@ declare class Spring {
|
|
|
65
67
|
set precision(value: number);
|
|
66
68
|
get resting(): boolean;
|
|
67
69
|
onUpdate(callback: () => void): () => void;
|
|
68
|
-
|
|
70
|
+
onStart(callback: () => void): () => void;
|
|
71
|
+
onStop(callback: () => void): () => void;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
interface SpringOptions {
|
|
@@ -17,6 +17,7 @@ declare class Solver {
|
|
|
17
17
|
set damping(value: number);
|
|
18
18
|
get position(): number;
|
|
19
19
|
set position(value: number);
|
|
20
|
+
get lazyPosition(): number;
|
|
20
21
|
get velocity(): number;
|
|
21
22
|
set velocity(value: number);
|
|
22
23
|
get precision(): number;
|
|
@@ -25,9 +26,10 @@ declare class Solver {
|
|
|
25
26
|
get naturalFrequency(): number;
|
|
26
27
|
get criticalDamping(): number;
|
|
27
28
|
get dampingRatio(): number;
|
|
28
|
-
tick(dt: number): void;
|
|
29
|
+
tick(dt: number, emit?: boolean): void;
|
|
29
30
|
onUpdate(callback: () => void): () => void;
|
|
30
|
-
|
|
31
|
+
onStart(callback: () => void): () => void;
|
|
32
|
+
onStop(callback: () => void): () => void;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
declare class Scheduler {
|
|
@@ -65,7 +67,8 @@ declare class Spring {
|
|
|
65
67
|
set precision(value: number);
|
|
66
68
|
get resting(): boolean;
|
|
67
69
|
onUpdate(callback: () => void): () => void;
|
|
68
|
-
|
|
70
|
+
onStart(callback: () => void): () => void;
|
|
71
|
+
onStop(callback: () => void): () => void;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
interface SpringOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coily",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Simulate values using spring physics",
|
|
5
5
|
"author": "Tim Morris <timthewebguy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/tkofh/coily#readme",
|
|
@@ -36,17 +36,15 @@
|
|
|
36
36
|
"url": "https://github.com/tkofh/coily/issues"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@vitest/coverage-v8": "^2.0.4",
|
|
40
|
-
"@vitest/ui": "^2.0.4",
|
|
41
39
|
"unbuild": "^2.0.0",
|
|
42
|
-
"vitest": "^2.
|
|
40
|
+
"vitest": "^2.1.4"
|
|
43
41
|
},
|
|
44
42
|
"dependencies": {
|
|
45
43
|
"tickloop": "^0.5.0"
|
|
46
44
|
},
|
|
47
45
|
"scripts": {
|
|
48
46
|
"build": "unbuild",
|
|
49
|
-
"test": "vitest",
|
|
47
|
+
"test": "vitest run",
|
|
50
48
|
"prepublish": "bun run build"
|
|
51
49
|
}
|
|
52
50
|
}
|