@datamoc/mw_games 0.37.0 → 0.39.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +26 -0
  3. package/api-surface.json +650 -2
  4. package/dist/assets/SvgParts.d.ts +31 -0
  5. package/dist/assets/SvgParts.d.ts.map +1 -0
  6. package/dist/assets/SvgParts.js +54 -0
  7. package/dist/assets/SvgParts.js.map +1 -0
  8. package/dist/assets/SvgSource.d.ts +3 -0
  9. package/dist/assets/SvgSource.d.ts.map +1 -0
  10. package/dist/assets/SvgSource.js +22 -0
  11. package/dist/assets/SvgSource.js.map +1 -0
  12. package/dist/assets/index.d.ts +2 -0
  13. package/dist/assets/index.d.ts.map +1 -1
  14. package/dist/assets/index.js +1 -0
  15. package/dist/assets/index.js.map +1 -1
  16. package/dist/assets/svg.d.ts.map +1 -1
  17. package/dist/assets/svg.js +9 -5
  18. package/dist/assets/svg.js.map +1 -1
  19. package/dist/mw_games.global.js +110 -110
  20. package/dist/mwl/presentation.d.ts +70 -0
  21. package/dist/mwl/presentation.d.ts.map +1 -0
  22. package/dist/mwl/presentation.js +419 -0
  23. package/dist/mwl/presentation.js.map +1 -0
  24. package/dist/physics/PhysicsWorld.d.ts +49 -17
  25. package/dist/physics/PhysicsWorld.d.ts.map +1 -1
  26. package/dist/physics/PhysicsWorld.js +297 -59
  27. package/dist/physics/PhysicsWorld.js.map +1 -1
  28. package/dist/physics/XpbdWorld.d.ts +1 -1
  29. package/dist/physics/XpbdWorld.js +1 -1
  30. package/dist/physics/cloth/index.d.ts +98 -0
  31. package/dist/physics/cloth/index.d.ts.map +1 -0
  32. package/dist/physics/cloth/index.js +207 -0
  33. package/dist/physics/cloth/index.js.map +1 -0
  34. package/dist/physics/index.d.ts +4 -0
  35. package/dist/physics/index.d.ts.map +1 -1
  36. package/dist/physics/index.js +2 -0
  37. package/dist/physics/index.js.map +1 -1
  38. package/dist/physics/spring/index.d.ts +90 -0
  39. package/dist/physics/spring/index.d.ts.map +1 -0
  40. package/dist/physics/spring/index.js +97 -0
  41. package/dist/physics/spring/index.js.map +1 -0
  42. package/dist/skeleton/index.d.ts +94 -13
  43. package/dist/skeleton/index.d.ts.map +1 -1
  44. package/dist/skeleton/index.js +192 -73
  45. package/dist/skeleton/index.js.map +1 -1
  46. package/dist/two-d/presentation/MwlPresentation.d.ts +110 -0
  47. package/dist/two-d/presentation/MwlPresentation.d.ts.map +1 -0
  48. package/dist/two-d/presentation/MwlPresentation.js +755 -0
  49. package/dist/two-d/presentation/MwlPresentation.js.map +1 -0
  50. package/dist/two-d/presentation/index.d.ts +3 -0
  51. package/dist/two-d/presentation/index.d.ts.map +1 -0
  52. package/dist/two-d/presentation/index.js +2 -0
  53. package/dist/two-d/presentation/index.js.map +1 -0
  54. package/dist/two-d/render/ClothSprite.d.ts +83 -0
  55. package/dist/two-d/render/ClothSprite.d.ts.map +1 -0
  56. package/dist/two-d/render/ClothSprite.js +105 -0
  57. package/dist/two-d/render/ClothSprite.js.map +1 -0
  58. package/dist/two-d/render/HazeLayer.d.ts +112 -0
  59. package/dist/two-d/render/HazeLayer.d.ts.map +1 -0
  60. package/dist/two-d/render/HazeLayer.js +185 -0
  61. package/dist/two-d/render/HazeLayer.js.map +1 -0
  62. package/dist/two-d/render/NeonGlow.d.ts +100 -0
  63. package/dist/two-d/render/NeonGlow.d.ts.map +1 -0
  64. package/dist/two-d/render/NeonGlow.js +183 -0
  65. package/dist/two-d/render/NeonGlow.js.map +1 -0
  66. package/dist/two-d/render/SkeletalSprite.d.ts +5 -2
  67. package/dist/two-d/render/SkeletalSprite.d.ts.map +1 -1
  68. package/dist/two-d/render/SkeletalSprite.js +27 -3
  69. package/dist/two-d/render/SkeletalSprite.js.map +1 -1
  70. package/dist/two-d/render/SpringSprite.d.ts +40 -0
  71. package/dist/two-d/render/SpringSprite.d.ts.map +1 -0
  72. package/dist/two-d/render/SpringSprite.js +39 -0
  73. package/dist/two-d/render/SpringSprite.js.map +1 -0
  74. package/dist/two-d/render/SpriteDeform.d.ts +156 -0
  75. package/dist/two-d/render/SpriteDeform.d.ts.map +1 -0
  76. package/dist/two-d/render/SpriteDeform.js +278 -0
  77. package/dist/two-d/render/SpriteDeform.js.map +1 -0
  78. package/dist/two-d/render/SvgSkeleton.d.ts +54 -0
  79. package/dist/two-d/render/SvgSkeleton.d.ts.map +1 -0
  80. package/dist/two-d/render/SvgSkeleton.js +112 -0
  81. package/dist/two-d/render/SvgSkeleton.js.map +1 -0
  82. package/dist/two-d/render/index.d.ts +12 -0
  83. package/dist/two-d/render/index.d.ts.map +1 -1
  84. package/dist/two-d/render/index.js +6 -0
  85. package/dist/two-d/render/index.js.map +1 -1
  86. package/dist/two-d/ui/Bar.d.ts +3 -1
  87. package/dist/two-d/ui/Bar.d.ts.map +1 -1
  88. package/dist/two-d/ui/Bar.js +5 -0
  89. package/dist/two-d/ui/Bar.js.map +1 -1
  90. package/dist/two-d/ui/Button.d.ts +12 -0
  91. package/dist/two-d/ui/Button.d.ts.map +1 -1
  92. package/dist/two-d/ui/Button.js +16 -4
  93. package/dist/two-d/ui/Button.js.map +1 -1
  94. package/dist/two-d/ui/Window.d.ts +10 -0
  95. package/dist/two-d/ui/Window.d.ts.map +1 -1
  96. package/dist/two-d/ui/Window.js +17 -6
  97. package/dist/two-d/ui/Window.js.map +1 -1
  98. package/dist/two-d/ui/index.d.ts +2 -0
  99. package/dist/two-d/ui/index.d.ts.map +1 -1
  100. package/dist/two-d/ui/index.js.map +1 -1
  101. package/dist/version.d.ts +1 -1
  102. package/dist/version.js +1 -1
  103. package/package.json +24 -7
  104. package/sbom.cdx.json +6 -58
  105. package/tools/asset-report.d.mts +37 -0
  106. package/tools/asset-report.mjs +157 -0
  107. package/tools/compile-resources.d.mts +2 -0
  108. package/tools/compile-resources.mjs +23 -2
  109. package/tools/emit-page.d.mts +2 -0
  110. package/tools/emit-page.mjs +11 -1
  111. package/tools/verify-scenarios.d.mts +15 -0
  112. package/tools/verify-scenarios.mjs +129 -0
  113. package/tools/vite.mjs +4 -1
@@ -0,0 +1,207 @@
1
+ function assertFinitePair(value, name) {
2
+ const pair = value ?? { x: 0, y: 0 };
3
+ if (!Number.isFinite(pair.x) || !Number.isFinite(pair.y)) {
4
+ throw new RangeError(`a cloth ${name} needs finite coordinates, saw (${pair.x}, ${pair.y})`);
5
+ }
6
+ return { x: pair.x, y: pair.y };
7
+ }
8
+ export class Cloth {
9
+ constructor(options) {
10
+ if (!Number.isFinite(options.width) || options.width <= 0) {
11
+ throw new RangeError(`a cloth needs width above 0, saw ${options.width}`);
12
+ }
13
+ if (!Number.isFinite(options.height) || options.height <= 0) {
14
+ throw new RangeError(`a cloth needs height above 0, saw ${options.height}`);
15
+ }
16
+ for (const key of ['segmentsX', 'segmentsY']) {
17
+ if (!Number.isInteger(options[key]) || options[key] < 1) {
18
+ throw new RangeError(`a cloth needs integer ${key} of at least 1, saw ${options[key]}`);
19
+ }
20
+ }
21
+ const stiffness = options.stiffness ?? 0.9;
22
+ if (!Number.isFinite(stiffness) || stiffness < 0 || stiffness > 1) {
23
+ throw new RangeError(`a cloth needs stiffness between 0 and 1, saw ${stiffness}`);
24
+ }
25
+ const damping = options.damping ?? 0.02;
26
+ if (!Number.isFinite(damping) || damping < 0 || damping > 1) {
27
+ throw new RangeError(`a cloth needs damping between 0 and 1, saw ${damping}`);
28
+ }
29
+ this.segmentsX = options.segmentsX;
30
+ this.segmentsY = options.segmentsY;
31
+ this.stiffness = stiffness;
32
+ this.damping = damping;
33
+ this.gravity = assertFinitePair(options.gravity, 'gravity');
34
+ this.wind = assertFinitePair(options.wind, 'wind');
35
+ const count = this.pointCount;
36
+ this.rest = new Float32Array(count * 2);
37
+ this.positions = new Float32Array(count * 2);
38
+ this.previous = new Float32Array(count * 2);
39
+ this.pinned = new Uint8Array(count);
40
+ this.links = [];
41
+ const stepX = options.width / options.segmentsX;
42
+ const stepY = options.height / options.segmentsY;
43
+ for (let row = 0; row <= options.segmentsY; row++) {
44
+ for (let column = 0; column <= options.segmentsX; column++) {
45
+ const index = this.indexOf(column, row);
46
+ this.rest[index * 2] = column * stepX;
47
+ this.rest[index * 2 + 1] = row * stepY;
48
+ //the top edge is the attachment: a waistband, a held scarf end, a curtain rail
49
+ if (row === 0)
50
+ this.pinned[index] = 1;
51
+ }
52
+ }
53
+ this.reset();
54
+ const at = (column, row) => this.indexOf(column, row);
55
+ for (let row = 0; row <= options.segmentsY; row++) {
56
+ for (let column = 0; column < options.segmentsX; column++) {
57
+ this.links.push([at(column, row), at(column + 1, row), stepX]);
58
+ }
59
+ }
60
+ for (let row = 0; row < options.segmentsY; row++) {
61
+ for (let column = 0; column <= options.segmentsX; column++) {
62
+ this.links.push([at(column, row), at(column, row + 1), stepY]);
63
+ }
64
+ }
65
+ }
66
+ /** how many simulated points the mesh holds */
67
+ get pointCount() {
68
+ return (this.segmentsX + 1) * (this.segmentsY + 1);
69
+ }
70
+ /** the flat index of the point at `(column, row)`; throws a RangeError outside the grid */
71
+ indexOf(column, row) {
72
+ if (!Number.isInteger(column) ||
73
+ !Number.isInteger(row) ||
74
+ column < 0 ||
75
+ row < 0 ||
76
+ column > this.segmentsX ||
77
+ row > this.segmentsY) {
78
+ throw new RangeError(`cloth point (${column}, ${row}) is outside a ${this.segmentsX + 1}x${this.segmentsY + 1} grid`);
79
+ }
80
+ return row * (this.segmentsX + 1) + column;
81
+ }
82
+ checkIndex(index) {
83
+ if (!Number.isInteger(index) || index < 0 || index >= this.pointCount) {
84
+ throw new RangeError(`cloth point ${index} does not exist`);
85
+ }
86
+ }
87
+ /** the current position of one point */
88
+ pointPosition(index) {
89
+ this.checkIndex(index);
90
+ return { x: this.positions[index * 2], y: this.positions[index * 2 + 1] };
91
+ }
92
+ /** whether a point is pinned (integration and relaxation both leave it alone) */
93
+ isPinned(index) {
94
+ this.checkIndex(index);
95
+ return this.pinned[index] === 1;
96
+ }
97
+ /** index pairs joined by a structural constraint, row links then column links, for drawing the mesh */
98
+ pointLinks() {
99
+ return this.links.map(([a, b]) => [a, b]);
100
+ }
101
+ /** pin a point where it currently stands */
102
+ pinPoint(index) {
103
+ this.checkIndex(index);
104
+ this.pinned[index] = 1;
105
+ this.previous[index * 2] = this.positions[index * 2];
106
+ this.previous[index * 2 + 1] = this.positions[index * 2 + 1];
107
+ }
108
+ /** release a pinned point; it keeps its current position and moves from there */
109
+ unpinPoint(index) {
110
+ this.checkIndex(index);
111
+ this.pinned[index] = 0;
112
+ }
113
+ /** replace the wind acceleration; validated, so a gust can never smuggle in a NaN */
114
+ setWind(x, y) {
115
+ const pair = assertFinitePair({ x, y }, 'wind');
116
+ this.wind = pair;
117
+ }
118
+ /** replace the gravity acceleration */
119
+ setGravity(x, y) {
120
+ const pair = assertFinitePair({ x, y }, 'gravity');
121
+ this.gravity = pair;
122
+ }
123
+ /** put every point back at rest with no velocity; pins are kept */
124
+ reset() {
125
+ this.positions.set(this.rest);
126
+ this.previous.set(this.rest);
127
+ }
128
+ /** how many points currently sit away from their rest positions */
129
+ movedCount() {
130
+ let moved = 0;
131
+ for (let index = 0; index < this.pointCount; index++) {
132
+ if (this.positions[index * 2] !== this.rest[index * 2]) {
133
+ moved++;
134
+ continue;
135
+ }
136
+ if (this.positions[index * 2 + 1] !== this.rest[index * 2 + 1])
137
+ moved++;
138
+ }
139
+ return moved;
140
+ }
141
+ /**
142
+ * Write every current position into `into`, which must hold exactly
143
+ * `pointCount * 2` floats. The mesh side calls this with its GPU position array.
144
+ */
145
+ writePositions(into) {
146
+ if (!(into instanceof Float32Array) || into.length !== this.positions.length) {
147
+ throw new RangeError(`a cloth target needs a Float32Array of ${this.positions.length} floats, saw length ${into?.length}`);
148
+ }
149
+ into.set(this.positions);
150
+ }
151
+ /**
152
+ * Advance the mesh by `dt` seconds: one Verlet integration pass, then two relaxation
153
+ * passes over the structural links. Call with a fixed `dt` (a `FixedStepper` does that)
154
+ * for a deterministic sequence; keep it small (60 Hz steps), since Verlet answers a
155
+ * huge step with a huge swing rather than an error. A zero `dt` holds still; a negative
156
+ * or non-finite one throws a RangeError.
157
+ */
158
+ update(dt) {
159
+ if (!Number.isFinite(dt) || dt < 0) {
160
+ throw new RangeError(`a cloth update needs dt of at least 0, saw ${dt}`);
161
+ }
162
+ if (dt === 0)
163
+ return;
164
+ const keep = 1 - this.damping;
165
+ const ax = (this.gravity.x + this.wind.x) * dt * dt;
166
+ const ay = (this.gravity.y + this.wind.y) * dt * dt;
167
+ const { positions, previous, pinned } = this;
168
+ for (let index = 0; index < this.pointCount; index++) {
169
+ if (pinned[index] === 1)
170
+ continue;
171
+ const x = positions[index * 2];
172
+ const y = positions[index * 2 + 1];
173
+ positions[index * 2] = x + (x - previous[index * 2]) * keep + ax;
174
+ positions[index * 2 + 1] = y + (y - previous[index * 2 + 1]) * keep + ay;
175
+ previous[index * 2] = x;
176
+ previous[index * 2 + 1] = y;
177
+ }
178
+ //two passes are the whole solver: enough to hold a hem together, few enough to budget
179
+ for (let pass = 0; pass < 2; pass++)
180
+ this.relax();
181
+ }
182
+ relax() {
183
+ const { positions, pinned, stiffness } = this;
184
+ if (stiffness === 0)
185
+ return;
186
+ for (const [a, b, rest] of this.links) {
187
+ const dx = positions[b * 2] - positions[a * 2];
188
+ const dy = positions[b * 2 + 1] - positions[a * 2 + 1];
189
+ const distance = Math.hypot(dx, dy);
190
+ if (distance === 0)
191
+ continue;
192
+ const error = ((distance - rest) / distance) * stiffness;
193
+ const aPinned = pinned[a] === 1;
194
+ const bPinned = pinned[b] === 1;
195
+ if (aPinned && bPinned)
196
+ continue;
197
+ //an anchored end takes the whole correction so the free end does the travelling
198
+ const aShare = aPinned ? 0 : bPinned ? 1 : 0.5;
199
+ const bShare = bPinned ? 0 : aPinned ? 1 : 0.5;
200
+ positions[a * 2] += dx * error * aShare;
201
+ positions[a * 2 + 1] += dy * error * aShare;
202
+ positions[b * 2] -= dx * error * bShare;
203
+ positions[b * 2 + 1] -= dy * error * bShare;
204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CACD"}
@@ -1,3 +1,7 @@
1
1
  export { PhysicsWorld } from './PhysicsWorld.ts';
2
2
  export type { BodyOptions, ConstraintOptions, PhysicsBody, PhysicsConstraint, PhysicsOptions } from './PhysicsWorld.ts';
3
+ export { Cloth } from './cloth/index.ts';
4
+ export type { ClothOptions } from './cloth/index.ts';
5
+ export { Spring } from './spring/index.ts';
6
+ export type { SpringOptions } from './spring/index.ts';
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/physics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/physics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export { PhysicsWorld } from './PhysicsWorld.js';
2
+ export { Cloth } from './cloth/index.js';
3
+ export { Spring } from './spring/index.js';
2
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/physics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/physics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { type MotionIntent } from '../../core/Motion.ts';
2
+ /**
3
+ * A damped chase spring for secondary motion: one bob pulled toward a moving anchor,
4
+ * the spring-damper complement to `SpriteMotion` (roadmap 424). Hair, hems, accessories
5
+ * and interface panels follow their anchor with lag, overshoot on a stop and settle;
6
+ * the anchor teleports (a head bone, a pointer, a panel edge) and the dynamics supply
7
+ * the lag, so reacting to an acceleration, a stop or an impact is one `setAnchor` call.
8
+ *
9
+ * Renderer-free arithmetic: semi-implicit Euler, no randomness, no engine, deterministic
10
+ * for a fixed `update(dt)` sequence. One update is O(1), about a dozen flops, which is
11
+ * the frame budget stated rather than hoped for.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { Spring } from '@datamoc/mw_games/physics';
16
+ *
17
+ * const hair = new Spring({ stiffness: 120, damping: 8 });
18
+ * hair.setAnchor(10, 0); // the head moved; the bob is still behind
19
+ * hair.update(1 / 60);
20
+ * console.log(hair.offset().x > 0); // true - the bob lags behind the anchor
21
+ * for (let i = 0; i < 240; i++) hair.update(1 / 60);
22
+ * console.log(hair.settled(0.01)); // true - a damped spring comes to rest at its anchor
23
+ * ```
24
+ */
25
+ export interface SpringOptions {
26
+ /** pull per unit of displacement, per second squared; must be finite and above 0 */
27
+ stiffness: number;
28
+ /** velocity lost per unit of velocity, per second; must be finite and at least 0 */
29
+ damping: number;
30
+ /** where the anchor starts; default `{ x: 0, y: 0 }` */
31
+ anchor?: {
32
+ x: number;
33
+ y: number;
34
+ };
35
+ /** where the bob starts; default at the anchor, at rest */
36
+ position?: {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ /** what the lag is for under reduced motion; default `decorative`, which snaps to the anchor */
41
+ intent?: MotionIntent;
42
+ }
43
+ export declare class Spring {
44
+ readonly stiffness: number;
45
+ readonly damping: number;
46
+ private readonly intent;
47
+ private readonly anchor;
48
+ private readonly bob;
49
+ private readonly velocity;
50
+ constructor(options: SpringOptions);
51
+ /** where the anchor currently stands */
52
+ get anchorPosition(): {
53
+ x: number;
54
+ y: number;
55
+ };
56
+ /** where the bob currently stands */
57
+ get position(): {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ /** move the anchor; the bob follows through the dynamics, which is the whole effect */
62
+ setAnchor(x: number, y: number): void;
63
+ /** shove the bob by a delta without touching its velocity: an impact, a pluck, a shove */
64
+ displace(dx: number, dy: number): void;
65
+ /** put the bob at the anchor with no velocity */
66
+ snap(): void;
67
+ /** the bob minus the anchor: the lag a follower draws */
68
+ offset(): {
69
+ x: number;
70
+ y: number;
71
+ };
72
+ /** how far the bob currently lags behind the anchor */
73
+ length(): number;
74
+ /** true once the lag and the velocity both fit inside `tolerance` */
75
+ settled(tolerance: number): boolean;
76
+ /** put a display object where the bob stands; a `SpriteMotion` target qualifies */
77
+ place(target: {
78
+ x: number;
79
+ y: number;
80
+ }): void;
81
+ /**
82
+ * Advance the bob by `dt` seconds. Under reduced motion a decorative spring snaps to
83
+ * its anchor instead of swinging, the same collapse `SpriteMotion` applies. Keep `dt`
84
+ * small (a `FixedStepper` at 60 Hz): past roughly two radians of natural frequency per
85
+ * step, semi-implicit Euler blows up instead of settling. A zero `dt` holds still; a
86
+ * negative or non-finite one throws a RangeError.
87
+ */
88
+ update(dt: number): void;
89
+ }
90
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/physics/spring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa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,CAAA;KAAE,CAEjC;IAED,uDAAuD;IACvD,MAAM,IAAI,MAAM,CAEf;IAED,qEAAqE;IACrE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAKlC;IAED,mFAAmF;IACnF,KAAK,CAAC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAG5C;IAED;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAevB;CACD"}
@@ -0,0 +1,97 @@
1
+ import { reducedMotion } from '../../core/Motion.js';
2
+ function assertPoint(value, name) {
3
+ if (!Number.isFinite(value.x) || !Number.isFinite(value.y)) {
4
+ throw new RangeError(`a spring ${name} needs finite coordinates, saw (${value.x}, ${value.y})`);
5
+ }
6
+ return { x: value.x, y: value.y };
7
+ }
8
+ export class Spring {
9
+ constructor(options) {
10
+ if (!Number.isFinite(options.stiffness) || options.stiffness <= 0) {
11
+ throw new RangeError(`a spring needs stiffness above 0, saw ${options.stiffness}`);
12
+ }
13
+ if (!Number.isFinite(options.damping) || options.damping < 0) {
14
+ throw new RangeError(`a spring needs damping of at least 0, saw ${options.damping}`);
15
+ }
16
+ this.stiffness = options.stiffness;
17
+ this.damping = options.damping;
18
+ this.intent = options.intent ?? 'decorative';
19
+ const anchor = options.anchor ? assertPoint(options.anchor, 'anchor') : { x: 0, y: 0 };
20
+ const start = options.position ? assertPoint(options.position, 'position') : { ...anchor };
21
+ this.anchor = anchor;
22
+ this.bob = start;
23
+ this.velocity = { x: 0, y: 0 };
24
+ }
25
+ /** where the anchor currently stands */
26
+ get anchorPosition() {
27
+ return { ...this.anchor };
28
+ }
29
+ /** where the bob currently stands */
30
+ get position() {
31
+ return { ...this.bob };
32
+ }
33
+ /** move the anchor; the bob follows through the dynamics, which is the whole effect */
34
+ setAnchor(x, y) {
35
+ const pair = assertPoint({ x, y }, 'anchor');
36
+ this.anchor.x = pair.x;
37
+ this.anchor.y = pair.y;
38
+ }
39
+ /** shove the bob by a delta without touching its velocity: an impact, a pluck, a shove */
40
+ displace(dx, dy) {
41
+ const pair = assertPoint({ x: dx, y: dy }, 'displacement');
42
+ this.bob.x += pair.x;
43
+ this.bob.y += pair.y;
44
+ }
45
+ /** put the bob at the anchor with no velocity */
46
+ snap() {
47
+ this.bob.x = this.anchor.x;
48
+ this.bob.y = this.anchor.y;
49
+ this.velocity.x = 0;
50
+ this.velocity.y = 0;
51
+ }
52
+ /** the bob minus the anchor: the lag a follower draws */
53
+ offset() {
54
+ return { x: this.bob.x - this.anchor.x, y: this.bob.y - this.anchor.y };
55
+ }
56
+ /** how far the bob currently lags behind the anchor */
57
+ length() {
58
+ return Math.hypot(this.bob.x - this.anchor.x, this.bob.y - this.anchor.y);
59
+ }
60
+ /** true once the lag and the velocity both fit inside `tolerance` */
61
+ settled(tolerance) {
62
+ if (!Number.isFinite(tolerance) || tolerance < 0) {
63
+ throw new RangeError(`a spring settle check needs tolerance of at least 0, saw ${tolerance}`);
64
+ }
65
+ return this.length() <= tolerance && Math.hypot(this.velocity.x, this.velocity.y) <= tolerance;
66
+ }
67
+ /** put a display object where the bob stands; a `SpriteMotion` target qualifies */
68
+ place(target) {
69
+ target.x = this.bob.x;
70
+ target.y = this.bob.y;
71
+ }
72
+ /**
73
+ * Advance the bob by `dt` seconds. Under reduced motion a decorative spring snaps to
74
+ * its anchor instead of swinging, the same collapse `SpriteMotion` applies. Keep `dt`
75
+ * small (a `FixedStepper` at 60 Hz): past roughly two radians of natural frequency per
76
+ * step, semi-implicit Euler blows up instead of settling. A zero `dt` holds still; a
77
+ * negative or non-finite one throws a RangeError.
78
+ */
79
+ update(dt) {
80
+ if (!Number.isFinite(dt) || dt < 0) {
81
+ throw new RangeError(`a spring update needs dt of at least 0, saw ${dt}`);
82
+ }
83
+ if (reducedMotion() && this.intent === 'decorative') {
84
+ this.snap();
85
+ return;
86
+ }
87
+ if (dt === 0)
88
+ return;
89
+ const ax = this.stiffness * (this.anchor.x - this.bob.x) - this.damping * this.velocity.x;
90
+ const ay = this.stiffness * (this.anchor.y - this.bob.y) - this.damping * this.velocity.y;
91
+ this.velocity.x += ax * dt;
92
+ this.velocity.y += ay * dt;
93
+ this.bob.x += this.velocity.x * dt;
94
+ this.bob.y += this.velocity.y * dt;
95
+ }
96
+ }
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/physics/spring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AAsCxE,SAAS,WAAW,CAAC,KAA+B,EAAE,IAAY;IACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,UAAU,CAAC,YAAY,IAAI,mCAAmC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,MAAM;IAQlB,YAAY,OAAsB;QACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,UAAU,CAAC,yCAAyC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;YAC9D,MAAM,IAAI,UAAU,CAAC,6CAA6C,OAAO,CAAC,OAAO,EAAE,CAAC,CA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AI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;CACD"}
@@ -3,13 +3,14 @@
3
3
  *
4
4
  * The pose half of a skeletal puppet (roadmap 399), as pure data and arithmetic so it loads
5
5
  * headless and tests without a renderer - the same split every other module draws. A bone
6
- * is a name, a parent name, a length and a local rotation; a pose is one rotation per bone;
7
- * resolving a pose walks the tree so rotating an arm, a leg or a head is one number on one
8
- * bone and the rest of the body follows. Clips are keyframed poses over time - plain data a
9
- * game authors in JSON, never code, and never a borrowed game's animation data - with
10
- * interpolation, looping, a playback rate and a crossfade between clips. Additive layers
11
- * (aim on top of walk, hurt on top of idle) mix by priority, so a game composes motion
12
- * instead of authoring every combination as its own clip.
6
+ * is a name, a parent name, a length and a local rotation; a pose is one rotation per bone,
7
+ * with optional per-bone translations and scales riding the same timeline; resolving a pose
8
+ * walks the tree so rotating an arm, a leg or a head is one number on one bone and the rest
9
+ * of the body follows. Clips are keyframed poses over time - plain data a game authors in
10
+ * JSON, never code, and never a borrowed game's animation data - with interpolation,
11
+ * looping, a playback rate and a crossfade between clips. Additive layers (aim on top of
12
+ * walk, hurt on top of idle) mix by priority, so a game composes motion instead of
13
+ * authoring every combination as its own clip.
13
14
  *
14
15
  * @example
15
16
  * ```ts
@@ -42,16 +43,48 @@ export interface Bone {
42
43
  };
43
44
  /** the bone's rest rotation, degrees */
44
45
  rotation?: number;
46
+ /** absolute local-angle bounds, degrees; out-of-range poses fail at sample time */
47
+ limits?: {
48
+ min: number;
49
+ max: number;
50
+ };
45
51
  }
46
52
  export interface SkeletonBones {
47
53
  bones: readonly Bone[];
48
54
  }
49
55
  /** one rotation per bone name, degrees; a bone left out keeps its rest rotation */
50
56
  export type Pose = Readonly<Record<string, number>>;
57
+ /** a full pose: rotations plus optional per-bone translations and scales */
58
+ export interface TransformPose {
59
+ rotations: Pose;
60
+ translations?: Record<string, {
61
+ x: number;
62
+ y: number;
63
+ }>;
64
+ scales?: Record<string, {
65
+ x: number;
66
+ y: number;
67
+ }>;
68
+ }
69
+ /** a 2D affine matrix, row-major */
70
+ export interface AffineMatrix {
71
+ a: number;
72
+ b: number;
73
+ c: number;
74
+ d: number;
75
+ }
51
76
  export interface Keyframe {
52
77
  /** seconds into the clip */
53
78
  time: number;
54
79
  rotations: Pose;
80
+ translations?: Record<string, {
81
+ x: number;
82
+ y: number;
83
+ }>;
84
+ scales?: Record<string, {
85
+ x: number;
86
+ y: number;
87
+ }>;
55
88
  }
56
89
  export interface Clip {
57
90
  id: string;
@@ -95,21 +128,37 @@ export interface BoneTransform {
95
128
  y: number;
96
129
  /** the bone's angle in world space, degrees */
97
130
  angle: number;
131
+ /** the bone's world scale, composed down the chain */
132
+ scaleX: number;
133
+ scaleY: number;
134
+ /** the bone's world matrix: its rotation times its scale */
135
+ matrix: AffineMatrix;
98
136
  /** the bone's tip in world space, `length` along its angle */
99
137
  tipX: number;
100
138
  tipY: number;
101
139
  }
102
140
  /** names in dependency order: every bone after its parent, so resolution is one pass */
103
141
  export declare function boneOrder(skeleton: SkeletonBones): string[];
104
- /** create a skeleton, refusing duplicate names and cycles by name */
142
+ /** create a skeleton, refusing duplicate names, cycles and invalid joint limits by name */
105
143
  export declare function create(bones: readonly Bone[]): SkeletonBones;
106
144
  /**
107
- * A pose through the tree: each bone starts at its parent's tip plus its origin, rotated by
108
- * its rest rotation plus its pose rotation plus every ancestor's world rotation.
145
+ * A pose through the tree: each bone starts at its parent's tip plus its origin and
146
+ * translation, transformed by the parent's rotation and scale, and reaches along its
147
+ * own rotation and composed scale. Translations ride in the bone's rest frame; scales
148
+ * multiply down the chain, so a scaled parent carries its children with it.
149
+ */
150
+ export declare function resolve(skeleton: SkeletonBones, pose?: Pose | TransformPose): BoneTransform[];
151
+ /** the rotations a clip shows at `time`, interpolated, looped or held, validated */
152
+ export declare function samplePose(clip: Clip, time: number, skeleton?: SkeletonBones): Record<string, number>;
153
+ /** Sample every channel with the same timeline as rotations: holds the first frame
154
+ * before it, the last past the end of a one-shot, and wraps a looping clip.
155
+ * @example
156
+ * ```ts
157
+ * import { sampleTransformPose } from '@datamoc/mw_games/skeleton';
158
+ * const pose = sampleTransformPose({ id: 'idle', duration: 1, frames: [{ time: 0, rotations: {} }] }, 0.5);
159
+ * ```
109
160
  */
110
- export declare function resolve(skeleton: SkeletonBones, pose?: Pose): BoneTransform[];
111
- /** the pose a clip shows at `time`: its frames interpolated, looped or held */
112
- export declare function samplePose(clip: Clip, time: number): Record<string, number>;
161
+ export declare function sampleTransformPose(clip: Clip, time: number, skeleton?: SkeletonBones): TransformPose;
113
162
  /** move a playback's playhead, wrapping a looping clip and clamping a one-shot */
114
163
  export declare function advancePlayback(playback: Playback, dt: number): Playback;
115
164
  /** a mixer over a skeleton: one base clip, any number of weighted layers */
@@ -128,4 +177,36 @@ export declare function mixPoses(base: Pose, layers: ReadonlyArray<{
128
177
  * the world transforms are what the drawing side needs.
129
178
  */
130
179
  export declare function advance(mixer: Mixer, dt: number): Record<string, number>;
180
+ /** Advance all clip channels together, including crossfades and priority layers.
181
+ * @example
182
+ * ```ts
183
+ * import { create, createMixer, advancePose } from '@datamoc/mw_games/skeleton';
184
+ * const mixer = createMixer(create([{ name: 'body' }]), { id: 'bob', duration: 1,
185
+ * frames: [{ time: 0, rotations: {}, translations: { body: { x: 0, y: 4 } } }] });
186
+ * const pose = advancePose(mixer, 0.1);
187
+ * ```
188
+ */
189
+ export declare function advancePose(mixer: Mixer, dt: number): TransformPose;
190
+ /** Refuse non-finite rotations and absolute local angles outside a joint's bounds.
191
+ * @example
192
+ * ```ts
193
+ * import { create, validatePose } from '@datamoc/mw_games/skeleton';
194
+ * validatePose(create([{ name: 'knee', limits: { min: -120, max: 0 } }]), { knee: -30 });
195
+ * ```
196
+ */
197
+ export declare function validatePose(skeleton: SkeletonBones, pose: Pose): void;
198
+ /** Solve a connected two-bone chain toward a world target without stretching.
199
+ * Positive bend rotates the second bone clockwise in screen coordinates. Origins on the
200
+ * second bone must be zero; the solver accepts rotation-only poses.
201
+ * @example
202
+ * ```ts
203
+ * import { create, solveTwoBoneIK } from '@datamoc/mw_games/skeleton';
204
+ * const rig = create([{ name: 'upper', length: 10 }, { name: 'lower', parent: 'upper', length: 10 }]);
205
+ * const pose = solveTwoBoneIK(rig, 'upper', 'lower', { x: 10, y: 10 });
206
+ * ```
207
+ */
208
+ export declare function solveTwoBoneIK(skeleton: SkeletonBones, first: string, second: string, target: {
209
+ x: number;
210
+ y: number;
211
+ }, bend?: 1 | -1, pose?: Pose): Record<string, number>;
131
212
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skeleton/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,WAAW,IAAI;IACpB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACvB;AAED,mFAAmF;AACnF,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpD,MAAM,WAAW,QAAQ;IACxB,4B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