@flighthq/motionpath 0.5.1-next.920.da8f530 → 0.5.1-next.973.788d3d7
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/README.md +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/motionPath.d.ts +2 -0
- package/dist/motionPath.d.ts.map +1 -1
- package/dist/motionPath.js +7 -1
- package/dist/motionPath.js.map +1 -1
- package/package.json +5 -5
- package/src/motionPath.test.ts +25 -0
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/motionpath`. The `@f
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/motionpath@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/motionpath@0.5.1-next.973.788d3d7](https://github.com/flighthq/flight/tree/788d3d7375cca3a0233cecedda1a4e031bd26dec/packages/motionpath)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/788d3d7375cca3a0233cecedda1a4e031bd26dec/LICENSE.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createMotionPath, getMotionPathHeading, getMotionPathPosition, getMotionPathProgress, setMotionPathDistance, setMotionPathProgress, updateMotionPath, } from './contract';
|
|
1
|
+
export { createMotionPath, getMotionPathHeading, getMotionPathPosition, getMotionPathProgress, isMotionPathAtEnd, setMotionPathDistance, setMotionPathProgress, setMotionPathDirection, updateMotionPath, } from './contract';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createMotionPath, getMotionPathHeading, getMotionPathPosition, getMotionPathProgress, setMotionPathDistance, setMotionPathProgress, updateMotionPath, } from './contract';
|
|
1
|
+
export { createMotionPath, getMotionPathHeading, getMotionPathPosition, getMotionPathProgress, isMotionPathAtEnd, setMotionPathDistance, setMotionPathProgress, setMotionPathDirection, updateMotionPath, } from './contract';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dist/motionPath.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare function getMotionPathHeading(mp: Readonly<MotionPath>): number;
|
|
|
4
4
|
export declare function getMotionPathPosition(mp: Readonly<MotionPath>, pointOut: Vector2Like, tangentOut: Vector2Like): boolean;
|
|
5
5
|
export declare function getMotionPathProgress(mp: Readonly<MotionPath>): number;
|
|
6
6
|
export declare function initializeMotionPath(out: EntityConstruction<MotionPath>, path: Path, speed?: number, loopMode?: MotionPathLoopMode, tolerance?: number): void;
|
|
7
|
+
export declare function isMotionPathAtEnd(mp: Readonly<MotionPath>): boolean;
|
|
8
|
+
export declare function setMotionPathDirection(mp: MotionPath, direction: 1 | -1): void;
|
|
7
9
|
export declare function setMotionPathDistance(mp: MotionPath, distance: number): void;
|
|
8
10
|
export declare function setMotionPathProgress(mp: MotionPath, t: number): void;
|
|
9
11
|
export declare function updateMotionPath(mp: MotionPath, deltaTime: number): void;
|
package/dist/motionPath.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motionPath.d.ts","sourceRoot":"","sources":["../src/motionPath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,kBAAkB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEtH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,KAAK,SAAI,EACT,QAAQ,GAAE,kBAA4B,EACtC,SAAS,CAAC,EAAE,MAAM,GACjB,UAAU,CAIZ;AAMD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,CAGrE;AAMD,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,EACxB,QAAQ,EAAE,WAAW,EACrB,UAAU,EAAE,WAAW,GACtB,OAAO,CAET;
|
|
1
|
+
{"version":3,"file":"motionPath.d.ts","sourceRoot":"","sources":["../src/motionPath.ts"],"names":[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@@ -21,7 +21,6 @@ export function getMotionPathHeading(mp) {
|
|
|
21
21
|
export function getMotionPathPosition(mp, pointOut, tangentOut) {
|
|
22
22
|
return getPathPositionAtDistance(mp.path, mp.distance, pointOut, tangentOut);
|
|
23
23
|
}
|
|
24
|
-
const scratchTangent = createVector2();
|
|
25
24
|
// Return the marker's normalized progress along the path, `distance / length` in `[0, 1]`. A
|
|
26
25
|
// zero-length path reports 0.
|
|
27
26
|
export function getMotionPathProgress(mp) {
|
|
@@ -42,6 +41,12 @@ export function initializeMotionPath(out, path, speed = 0, loopMode = 'clamp', t
|
|
|
42
41
|
out.path = path;
|
|
43
42
|
out.speed = speed;
|
|
44
43
|
}
|
|
44
|
+
export function isMotionPathAtEnd(mp) {
|
|
45
|
+
return mp.direction > 0 ? mp.distance >= mp.length : mp.distance <= 0;
|
|
46
|
+
}
|
|
47
|
+
export function setMotionPathDirection(mp, direction) {
|
|
48
|
+
mp.direction = direction;
|
|
49
|
+
}
|
|
45
50
|
// Seek the marker to an absolute arc-length `distance`, clamping to the valid `[0, length]` range.
|
|
46
51
|
// Does not change `direction` or `speed`.
|
|
47
52
|
export function setMotionPathDistance(mp, distance) {
|
|
@@ -122,4 +127,5 @@ function applyMotionPathLoopMode(mp, move, length) {
|
|
|
122
127
|
clamped = length;
|
|
123
128
|
mp.distance = clamped;
|
|
124
129
|
}
|
|
130
|
+
const scratchTangent = createVector2();
|
|
125
131
|
//# sourceMappingURL=motionPath.js.map
|
package/dist/motionPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motionPath.js","sourceRoot":"","sources":["../src/motionPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAG7G,MAA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MAAM,CAAC;QACrC,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YACvB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACvB,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;YAChC,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QACpB,CAAC;QACD,OAAO;IACT,CAAC;IAED,QAAQ;IACR,IAAI,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,CAAC;SACxB,IAAI,OAAO,GAAG,MAAM;QAAE,OAAO,GAAG,MAAM,CAAC;IAC5C,EAAE,CAAC,QAAQ,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,cAAc,GAAG,aAAa,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/motionpath",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.973.788d3d7",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/geometry": "0.5.1-next.
|
|
43
|
-
"@flighthq/path": "0.5.1-next.
|
|
44
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.973.788d3d7",
|
|
42
|
+
"@flighthq/geometry": "0.5.1-next.973.788d3d7",
|
|
43
|
+
"@flighthq/path": "0.5.1-next.973.788d3d7",
|
|
44
|
+
"@flighthq/types": "0.5.1-next.973.788d3d7"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"typescript": "^5.3.0"
|
package/src/motionPath.test.ts
CHANGED
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
getMotionPathHeading,
|
|
8
8
|
getMotionPathPosition,
|
|
9
9
|
getMotionPathProgress,
|
|
10
|
+
isMotionPathAtEnd,
|
|
10
11
|
initializeMotionPath,
|
|
11
12
|
setMotionPathDistance,
|
|
12
13
|
setMotionPathProgress,
|
|
14
|
+
setMotionPathDirection,
|
|
13
15
|
updateMotionPath,
|
|
14
16
|
} from './motionPath';
|
|
15
17
|
|
|
@@ -100,6 +102,29 @@ describe('initializeMotionPath', () => {
|
|
|
100
102
|
});
|
|
101
103
|
});
|
|
102
104
|
|
|
105
|
+
describe('isMotionPathAtEnd', () => {
|
|
106
|
+
it('reports the terminal edge in the current direction', () => {
|
|
107
|
+
const mp = createMotionPath(line());
|
|
108
|
+
expect(isMotionPathAtEnd(mp)).toBe(false);
|
|
109
|
+
setMotionPathDistance(mp, 100);
|
|
110
|
+
expect(isMotionPathAtEnd(mp)).toBe(true);
|
|
111
|
+
setMotionPathDirection(mp, -1);
|
|
112
|
+
expect(isMotionPathAtEnd(mp)).toBe(false);
|
|
113
|
+
setMotionPathDistance(mp, 0);
|
|
114
|
+
expect(isMotionPathAtEnd(mp)).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('setMotionPathDirection', () => {
|
|
119
|
+
it('changes traversal direction without changing distance', () => {
|
|
120
|
+
const mp = createMotionPath(line());
|
|
121
|
+
setMotionPathDistance(mp, 25);
|
|
122
|
+
setMotionPathDirection(mp, -1);
|
|
123
|
+
expect(mp.direction).toBe(-1);
|
|
124
|
+
expect(mp.distance).toBe(25);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
103
128
|
// A straight horizontal line from (0,0) to (100,0): arc length 100.
|
|
104
129
|
describe('setMotionPathDistance', () => {
|
|
105
130
|
it('seeks to an absolute arc-length distance', () => {
|