@flighthq/tween 0.2.0 → 0.2.1-next.410.a23f189
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/package.json +4 -4
- package/src/updateTweens.test.ts +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/tween",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-next.410.a23f189",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/flighthq/flight.git",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@flighthq/easing": "0.2.
|
|
36
|
-
"@flighthq/signals": "0.2.
|
|
37
|
-
"@flighthq/types": "0.2.
|
|
35
|
+
"@flighthq/easing": "0.2.1-next.410.a23f189",
|
|
36
|
+
"@flighthq/signals": "0.2.1-next.410.a23f189",
|
|
37
|
+
"@flighthq/types": "0.2.1-next.410.a23f189"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^5.3.0"
|
package/src/updateTweens.test.ts
CHANGED
|
@@ -289,4 +289,27 @@ describe('updateTweens', () => {
|
|
|
289
289
|
updateTweens(manager, 500);
|
|
290
290
|
expect(target.x).toBeCloseTo(50); // 500ms of actual animation, not 1000ms
|
|
291
291
|
});
|
|
292
|
+
|
|
293
|
+
it('handles negative deltaTime without advancing', () => {
|
|
294
|
+
const manager = createTweenManager();
|
|
295
|
+
const target = { x: 0 };
|
|
296
|
+
const tween = createTween(manager, target, 1000, { x: 100 }, { ease: (t) => t });
|
|
297
|
+
updateTweens(manager, 500);
|
|
298
|
+
expect(target.x).toBeCloseTo(50);
|
|
299
|
+
// Negative delta subtracts from elapsed; activeElapsed drops below current,
|
|
300
|
+
// so clamp produces t <= previous t. Verify no NaN or crash.
|
|
301
|
+
updateTweens(manager, -200);
|
|
302
|
+
expect(Number.isFinite(target.x)).toBe(true);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('handles zero-duration tween without NaN', () => {
|
|
306
|
+
const manager = createTweenManager();
|
|
307
|
+
const target = { x: 0 };
|
|
308
|
+
const tween = createTween(manager, target, 0, { x: 100 }, { ease: (t) => t });
|
|
309
|
+
updateTweens(manager, 1);
|
|
310
|
+
// duration=0 means activeElapsed/duration is Infinity, clamped to 1 by Math.min
|
|
311
|
+
expect(target.x).toBe(100);
|
|
312
|
+
expect(tween.complete).toBe(true);
|
|
313
|
+
expect(Number.isFinite(target.x)).toBe(true);
|
|
314
|
+
});
|
|
292
315
|
});
|