@origingame/engine 0.0.0-stage → 0.1.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.
Files changed (158) hide show
  1. package/bin/og.mjs +25 -0
  2. package/dist/web/origin-engine.d.ts +1233 -0
  3. package/dist/web/origin-engine.js +8628 -0
  4. package/dist/web/origin-engine_bg.wasm +0 -0
  5. package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
  6. package/dist/web-publish/origin-engine-lanes.js +8509 -0
  7. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  8. package/dist/web-publish/origin-engine.d.ts +1176 -0
  9. package/dist/web-publish/origin-engine.js +8313 -0
  10. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  11. package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
  12. package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  13. package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
  14. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  15. package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
  16. package/dist/web-publish-2d/origin-engine.js +8313 -0
  17. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  18. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
  19. package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  20. package/knowledge/README.md +31 -0
  21. package/knowledge/knowledge.json +13 -0
  22. package/knowledge/looks/catalogue.json +1871 -0
  23. package/knowledge/package.json +33 -0
  24. package/knowledge/rules/platform.json +329 -0
  25. package/knowledge/scaffold/README.md +27 -0
  26. package/knowledge/scaffold/distribution.json +48 -0
  27. package/knowledge/scaffold/origin-engine.json +19 -0
  28. package/knowledge/scaffold/template/.origin/setup +14 -0
  29. package/knowledge/scaffold/template/LICENSES.md +23 -0
  30. package/knowledge/scaffold/template/README.md +37 -0
  31. package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
  32. package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
  33. package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
  34. package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
  35. package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
  36. package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
  37. package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
  38. package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
  39. package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
  40. package/knowledge/scaffold/template/gitattributes +22 -0
  41. package/knowledge/scaffold/template/package.json +18 -0
  42. package/knowledge/scaffold/template/project.ogt +25 -0
  43. package/knowledge/scaffold/template/src/main.ts +246 -0
  44. package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
  45. package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
  46. package/knowledge/scaffold/template/tsconfig.json +17 -0
  47. package/knowledge/scripts/lib.ts +203 -0
  48. package/knowledge/scripts/mount.ts +210 -0
  49. package/knowledge/scripts/pack.ts +24 -0
  50. package/knowledge/scripts/scaffold.ts +72 -0
  51. package/knowledge/scripts/validate.ts +749 -0
  52. package/knowledge/skills/og-ai/SKILL.md +386 -0
  53. package/knowledge/skills/og-audio/SKILL.md +191 -0
  54. package/knowledge/skills/og-build/SKILL.md +330 -0
  55. package/knowledge/skills/og-core/SKILL.md +285 -0
  56. package/knowledge/skills/og-feel/SKILL.md +385 -0
  57. package/knowledge/skills/og-game/SKILL.md +1479 -0
  58. package/knowledge/skills/og-i18n/SKILL.md +220 -0
  59. package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
  60. package/knowledge/skills/og-taste/SKILL.md +537 -0
  61. package/knowledge/skills/og-ui/SKILL.md +444 -0
  62. package/knowledge/wiki/ai.md +627 -0
  63. package/knowledge/wiki/anim.md +1187 -0
  64. package/knowledge/wiki/atmosphere.md +636 -0
  65. package/knowledge/wiki/audio.md +732 -0
  66. package/knowledge/wiki/camera.md +711 -0
  67. package/knowledge/wiki/commands.md +357 -0
  68. package/knowledge/wiki/game.md +220 -0
  69. package/knowledge/wiki/i18n.md +213 -0
  70. package/knowledge/wiki/index.md +1027 -0
  71. package/knowledge/wiki/input.md +1714 -0
  72. package/knowledge/wiki/load.md +1280 -0
  73. package/knowledge/wiki/math.md +166 -0
  74. package/knowledge/wiki/nav.md +1154 -0
  75. package/knowledge/wiki/physics.md +3142 -0
  76. package/knowledge/wiki/platform.md +857 -0
  77. package/knowledge/wiki/probe.md +1692 -0
  78. package/knowledge/wiki/reflect.md +285 -0
  79. package/knowledge/wiki/render.md +3511 -0
  80. package/knowledge/wiki/rng.md +393 -0
  81. package/knowledge/wiki/stream.md +376 -0
  82. package/knowledge/wiki/system.md +197 -0
  83. package/knowledge/wiki/systems.md +43 -0
  84. package/knowledge/wiki/terrain.md +727 -0
  85. package/knowledge/wiki/tilemap.md +422 -0
  86. package/knowledge/wiki/time.md +150 -0
  87. package/knowledge/wiki/transform.md +230 -0
  88. package/knowledge/wiki/tween.md +580 -0
  89. package/knowledge/wiki/ui.md +8000 -0
  90. package/knowledge/wiki/world.md +909 -0
  91. package/package.json +68 -4
  92. package/schema/api.schema.json +29675 -0
  93. package/shell/README.md +22 -0
  94. package/shell/brand/README.md +23 -0
  95. package/shell/brand/icon-192.png +0 -0
  96. package/shell/brand/icon-512.png +0 -0
  97. package/shell/brand/mark-on-paper.svg +6 -0
  98. package/shell/brand/origin-mark.svg +5 -0
  99. package/shell/brand/origin-motion.css +251 -0
  100. package/shell/brand/tokens.css +20 -0
  101. package/shell/brand.ts +132 -0
  102. package/shell/page.ts +715 -0
  103. package/shell/platform.ts +203 -0
  104. package/shell/player.ts +238 -0
  105. package/shell/shell.css +185 -0
  106. package/shell/sw.ts +177 -0
  107. package/shell/transport.ts +515 -0
  108. package/shell/wire.ts +369 -0
  109. package/src/e6.ts +69 -0
  110. package/src/env.d.ts +100 -0
  111. package/src/generated/abi.ts +980 -0
  112. package/src/index.ts +193 -0
  113. package/src/node/audio.ts +86 -0
  114. package/src/node/build.ts +109 -0
  115. package/src/node/device.ts +981 -0
  116. package/src/node/doctor.ts +60 -0
  117. package/src/node/index.ts +102 -0
  118. package/src/node/platform.ts +24 -0
  119. package/src/node/playtest-run.ts +249 -0
  120. package/src/node/png.ts +130 -0
  121. package/src/node/polish.ts +976 -0
  122. package/src/node/run.ts +373 -0
  123. package/src/node/web-build.ts +808 -0
  124. package/src/p2.ts +35 -0
  125. package/src/platform-local.ts +211 -0
  126. package/src/playtest.ts +131 -0
  127. package/src/runtime.ts +1509 -0
  128. package/src/systems/cameras.ts +247 -0
  129. package/src/ui-kit/bind.ts +141 -0
  130. package/src/ui-kit/huds.ts +303 -0
  131. package/src/ui-kit/index.ts +36 -0
  132. package/src/ui-kit/menus.ts +187 -0
  133. package/src/ui-kit/settings.ts +131 -0
  134. package/src/ui-kit/store.ts +222 -0
  135. package/src/ui-kit/story.ts +89 -0
  136. package/src/ui-kit/util.ts +106 -0
  137. package/src/web/a11y.ts +429 -0
  138. package/src/web/audio-worklet.ts +193 -0
  139. package/src/web/audio.ts +307 -0
  140. package/src/web/basis.ts +239 -0
  141. package/src/web/gamepad.ts +123 -0
  142. package/src/web/host.ts +166 -0
  143. package/src/web/input.ts +237 -0
  144. package/src/web/lanes.ts +21 -0
  145. package/src/web/play.ts +20 -0
  146. package/src/web/rpc-ring.ts +110 -0
  147. package/src/web/settle.ts +122 -0
  148. package/src/web/shell.ts +643 -0
  149. package/src/web/text-input.ts +248 -0
  150. package/src/web/worker.ts +1002 -0
  151. package/types/bindings.json +13654 -0
  152. package/types/index.d.ts +20090 -0
  153. package/vendor/basis/LICENSE +201 -0
  154. package/vendor/basis/NOTICE +15 -0
  155. package/vendor/basis/README.md +18 -0
  156. package/vendor/basis/basis_transcoder.js +19 -0
  157. package/vendor/basis/basis_transcoder.wasm +0 -0
  158. package/README.md +0 -3
@@ -0,0 +1,580 @@
1
+ <!-- Generated from crates/og-api/api.ogt by `og api gen`. Do not edit: `og api check` fails on any difference; change api.ogt and regenerate. -->
2
+
3
+ # The `tween` module
4
+
5
+ Tweens: animate any numeric field of a component (og.Transform.position, og.Sprite.color, og.Sprite.opacity, a game's own f32) from its value to a target over time with an easing curve, a delay, loops and yoyo; chain them in sequences or run them in parallel. Advanced by the engine's og.tween system after the game's systems and before og.anim and physics, by scaled time (slow motion, hit stop) unless unscaled.
6
+
7
+ Running tweens are world state (the og.tween state block): snapshots, restore and the world hash cover them. og.TweenCompleted reports a tween or group that ends on its own; a cancelled one, or one whose entity or component went away, ends silently.
8
+
9
+ Feel presets are tweens too: og.tween.squash (squash and stretch that recovers) and og.tween.flash (a hit flash that fades).
10
+
11
+ - **TypeScript**: functions are the namespace `og.tween`; components, resources and events are tokens on `og`.
12
+ - **Publish builds**: kept (members may override).
13
+ - **Skill**: `og-feel`, which teaches the module (how much of it to use, and how to prove it).
14
+ - **Index**: [every module and name](index.md).
15
+
16
+ ```ogt
17
+ module tween {
18
+ # declarations follow, each quoted below
19
+ ```
20
+
21
+ <sub>`api.ogt` line 6073</sub>
22
+
23
+ ## Contents
24
+
25
+ | Name | Kind | Summary |
26
+ |---|---|---|
27
+ | [`Tween`](#type-Tween) | handle | A running tween or group. |
28
+ | [`Tween()`](#column-Tween) | column kind | A Tween handle field. |
29
+ | [`Ease`](#type-Ease) | enum | An easing curve from the start (0) to the end (1). In starts slow, out ends slow, inOut both. back overshoots, elastic rings, bounce bounces at the end. |
30
+ | [`TweenDesc`](#type-TweenDesc) | desc struct | One tween of one field. |
31
+ | [`TweenGroupDesc`](#type-TweenGroupDesc) | desc struct | How a sequence or parallel group runs. |
32
+ | [`og.TweenCompleted`](#record-TweenCompleted) | event | A tween or group ended on its own (read in the tick after). |
33
+ | [`SquashDesc`](#type-SquashDesc) | desc struct | Squash and stretch: the entity's og.Transform.scale jumps to rest times impact and eases back to rest. |
34
+ | [`FlashDesc`](#type-FlashDesc) | desc struct | A hit flash: the entity's og.Sprite (else og.Mesh, else og.Model) flashColor set and its flash faded from amount to 0. |
35
+ | [`og.tween.to`](#fn-to) | function | Start a tween. Systems may call it; it first moves in this tick's og.tween run. |
36
+ | [`og.tween.sequence`](#fn-sequence) | function | Start tweens one after another (each with its own delay, duration and loops); the time one leaves over goes to the next. |
37
+ | [`og.tween.parallel`](#fn-parallel) | function | Start tweens together; the group ends with the last one. |
38
+ | [`og.tween.cancel`](#fn-cancel) | function | Stop a tween where it is (no event). |
39
+ | [`og.tween.cancelEntity`](#fn-cancelEntity) | function | Stop every tween of an entity (no events), say before starting a new reaction. |
40
+ | [`og.tween.active`](#fn-active) | function | Whether a tween is still running. |
41
+ | [`og.tween.squash`](#fn-squash) | function | Squash and stretch the entity's og.Transform.scale (cancels its earlier squash). |
42
+ | [`og.tween.flash`](#fn-flash) | function | Flash the entity's og.Sprite, its og.Mesh, or its og.Model (a glTF instance: this instance only, the others sharing its materials stay as they are). Cancels its earlier flash. |
43
+
44
+ ## Functions
45
+
46
+ <a id="fn-to"></a>
47
+
48
+ ### `og.tween.to`
49
+
50
+ Start a tween. Systems may call it; it first moves in this tick's og.tween run.
51
+
52
+ ```ts
53
+ og.tween.to(world: World, desc?: TweenDesc): Result<Tween>
54
+ ```
55
+
56
+ | Parameter | Type | Optional | Doc |
57
+ |---|---|---|---|
58
+ | `world` | `World` | no | The world. |
59
+ | `desc` | `TweenDesc` | yes | The field, the values and the timing. |
60
+
61
+ **Returns** `Result<Tween>`: Refused for a dead entity, a component it lacks, a field that is not numeric, or values of the wrong length.
62
+
63
+ Binding symbol `og_tween_to` · publish builds: kept
64
+
65
+ ```ogt
66
+ fn to {
67
+ doc "Start a tween. Systems may call it; it first moves in this tick's og.tween run."
68
+ param world World "The world."
69
+ param desc TweenDesc "The field, the values and the timing."
70
+ returns Result.Tween "Refused for a dead entity, a component it lacks, a field that is not numeric, or values of the wrong length."
71
+ }
72
+ ```
73
+
74
+ <sub>`api.ogt` line 6198</sub>
75
+
76
+ <a id="fn-sequence"></a>
77
+
78
+ ### `og.tween.sequence`
79
+
80
+ Start tweens one after another (each with its own delay, duration and loops); the time one leaves over goes to the next.
81
+
82
+ ```ts
83
+ og.tween.sequence(world: World, steps: readonly TweenDesc[], desc?: TweenGroupDesc): Result<Tween>
84
+ ```
85
+
86
+ | Parameter | Type | Optional | Doc |
87
+ |---|---|---|---|
88
+ | `world` | `World` | no | The world. |
89
+ | `steps` | `readonly TweenDesc[]` | no | The tweens, in order. |
90
+ | `desc` | `TweenGroupDesc` | yes | Loops, scaling and the tag. |
91
+
92
+ **Returns** `Result<Tween>`.
93
+
94
+ Binding symbol `og_tween_sequence` · publish builds: kept
95
+
96
+ ```ogt
97
+ fn sequence {
98
+ doc "Start tweens one after another (each with its own delay, duration and loops); the time one leaves over goes to the next."
99
+ param world World "The world."
100
+ param steps List.TweenDesc "The tweens, in order."
101
+ param desc TweenGroupDesc "Loops, scaling and the tag." {
102
+ optional true
103
+ }
104
+ returns Result.Tween
105
+ }
106
+ ```
107
+
108
+ <sub>`api.ogt` line 6205</sub>
109
+
110
+ <a id="fn-parallel"></a>
111
+
112
+ ### `og.tween.parallel`
113
+
114
+ Start tweens together; the group ends with the last one.
115
+
116
+ ```ts
117
+ og.tween.parallel(world: World, tweens: readonly TweenDesc[], desc?: TweenGroupDesc): Result<Tween>
118
+ ```
119
+
120
+ | Parameter | Type | Optional | Doc |
121
+ |---|---|---|---|
122
+ | `world` | `World` | no | The world. |
123
+ | `tweens` | `readonly TweenDesc[]` | no | The tweens. |
124
+ | `desc` | `TweenGroupDesc` | yes | Loops, scaling and the tag. |
125
+
126
+ **Returns** `Result<Tween>`.
127
+
128
+ Binding symbol `og_tween_parallel` · publish builds: kept
129
+
130
+ ```ogt
131
+ fn parallel {
132
+ doc "Start tweens together; the group ends with the last one."
133
+ param world World "The world."
134
+ param tweens List.TweenDesc "The tweens."
135
+ param desc TweenGroupDesc "Loops, scaling and the tag." {
136
+ optional true
137
+ }
138
+ returns Result.Tween
139
+ }
140
+ ```
141
+
142
+ <sub>`api.ogt` line 6215</sub>
143
+
144
+ <a id="fn-cancel"></a>
145
+
146
+ ### `og.tween.cancel`
147
+
148
+ Stop a tween where it is (no event).
149
+
150
+ ```ts
151
+ og.tween.cancel(world: World, tween: Tween): boolean
152
+ ```
153
+
154
+ | Parameter | Type | Optional | Doc |
155
+ |---|---|---|---|
156
+ | `world` | `World` | no | The world. |
157
+ | `tween` | `Tween` | no | The handle. |
158
+
159
+ **Returns** `boolean`: False when it was not running.
160
+
161
+ Binding symbol `og_tween_cancel` · publish builds: kept
162
+
163
+ ```ogt
164
+ fn cancel {
165
+ doc "Stop a tween where it is (no event)."
166
+ param world World "The world."
167
+ param tween Tween "The handle."
168
+ returns bool "False when it was not running."
169
+ }
170
+ ```
171
+
172
+ <sub>`api.ogt` line 6225</sub>
173
+
174
+ <a id="fn-cancelEntity"></a>
175
+
176
+ ### `og.tween.cancelEntity`
177
+
178
+ Stop every tween of an entity (no events), say before starting a new reaction.
179
+
180
+ ```ts
181
+ og.tween.cancelEntity(world: World, entity: Entity): number
182
+ ```
183
+
184
+ | Parameter | Type | Optional | Doc |
185
+ |---|---|---|---|
186
+ | `world` | `World` | no | The world. |
187
+ | `entity` | `Entity` | no | The entity. |
188
+
189
+ **Returns** `number`: How many stopped.
190
+
191
+ Binding symbol `og_tween_cancel_entity` · publish builds: kept
192
+
193
+ ```ogt
194
+ fn cancelEntity {
195
+ doc "Stop every tween of an entity (no events), say before starting a new reaction."
196
+ param world World "The world."
197
+ param entity Entity "The entity."
198
+ returns u32 "How many stopped."
199
+ }
200
+ ```
201
+
202
+ <sub>`api.ogt` line 6232</sub>
203
+
204
+ <a id="fn-active"></a>
205
+
206
+ ### `og.tween.active`
207
+
208
+ Whether a tween is still running.
209
+
210
+ ```ts
211
+ og.tween.active(world: World, tween: Tween): boolean
212
+ ```
213
+
214
+ | Parameter | Type | Optional | Doc |
215
+ |---|---|---|---|
216
+ | `world` | `World` | no | The world. |
217
+ | `tween` | `Tween` | no | The handle. |
218
+
219
+ **Returns** `boolean`.
220
+
221
+ Binding symbol `og_tween_active` · publish builds: kept
222
+
223
+ ```ogt
224
+ fn active {
225
+ doc "Whether a tween is still running."
226
+ param world World "The world."
227
+ param tween Tween "The handle."
228
+ returns bool
229
+ }
230
+ ```
231
+
232
+ <sub>`api.ogt` line 6239</sub>
233
+
234
+ <a id="fn-squash"></a>
235
+
236
+ ### `og.tween.squash`
237
+
238
+ Squash and stretch the entity's og.Transform.scale (cancels its earlier squash).
239
+
240
+ ```ts
241
+ og.tween.squash(world: World, desc?: SquashDesc): Result<Tween>
242
+ ```
243
+
244
+ | Parameter | Type | Optional | Doc |
245
+ |---|---|---|---|
246
+ | `world` | `World` | no | The world. |
247
+ | `desc` | `SquashDesc` | yes | The entity and the impact. |
248
+
249
+ **Returns** `Result<Tween>`: Refused for an entity without og.Transform.
250
+
251
+ Binding symbol `og_tween_squash` · publish builds: kept
252
+
253
+ ```ogt
254
+ fn squash {
255
+ doc "Squash and stretch the entity's og.Transform.scale (cancels its earlier squash)."
256
+ param world World "The world."
257
+ param desc SquashDesc "The entity and the impact."
258
+ returns Result.Tween "Refused for an entity without og.Transform."
259
+ }
260
+ ```
261
+
262
+ <sub>`api.ogt` line 6246</sub>
263
+
264
+ <a id="fn-flash"></a>
265
+
266
+ ### `og.tween.flash`
267
+
268
+ Flash the entity's og.Sprite, its og.Mesh, or its og.Model (a glTF instance: this instance only, the others sharing its materials stay as they are). Cancels its earlier flash.
269
+
270
+ ```ts
271
+ og.tween.flash(world: World, desc?: FlashDesc): Result<Tween>
272
+ ```
273
+
274
+ | Parameter | Type | Optional | Doc |
275
+ |---|---|---|---|
276
+ | `world` | `World` | no | The world. |
277
+ | `desc` | `FlashDesc` | yes | The entity and the flash. |
278
+
279
+ **Returns** `Result<Tween>`: Refused for an entity with none of og.Sprite, og.Mesh and og.Model.
280
+
281
+ Binding symbol `og_tween_flash` · publish builds: kept
282
+
283
+ ```ogt
284
+ fn flash {
285
+ doc "Flash the entity's og.Sprite, its og.Mesh, or its og.Model (a glTF instance: this instance only, the others sharing its materials stay as they are). Cancels its earlier flash."
286
+ param world World "The world."
287
+ param desc FlashDesc "The entity and the flash."
288
+ returns Result.Tween "Refused for an entity with none of og.Sprite, og.Mesh and og.Model."
289
+ }
290
+ ```
291
+
292
+ <sub>`api.ogt` line 6253</sub>
293
+
294
+ ## Components, resources and events
295
+
296
+ <a id="record-TweenCompleted"></a>
297
+
298
+ ### `og.TweenCompleted` (event)
299
+
300
+ A tween or group ended on its own (read in the tick after).
301
+
302
+ Token `og.TweenCompleted`, registered under the schema name `og.TweenCompleted`; its value type is `TweenCompleted`.
303
+
304
+ | Field | Type | Default | Range | Unit | Notes | Doc |
305
+ |---|---|---|---|---|---|---|
306
+ | `tween` | `Tween` | `0` | — | — | — | The handle og.tween.to, sequence, parallel, squash or flash answered. |
307
+ | `entity` | `Entity` | `0` | — | — | — | The entity of its (first) tween. |
308
+ | `tag` | `number` | `0` | — | — | — | Its tag. |
309
+
310
+ ```ogt
311
+ event TweenCompleted {
312
+ doc "A tween or group ended on its own (read in the tick after)."
313
+ field tween Tween "The handle og.tween.to, sequence, parallel, squash or flash answered."
314
+ field entity Entity "The entity of its (first) tween."
315
+ field tag u32 "Its tag."
316
+ }
317
+ ```
318
+
319
+ <sub>`api.ogt` line 6151</sub>
320
+
321
+ ## Types
322
+
323
+ <a id="type-Tween"></a>
324
+
325
+ ### `Tween` (handle)
326
+
327
+ A running tween or group.
328
+
329
+ A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
330
+
331
+ ```ogt
332
+ handle Tween "A running tween or group."
333
+ ```
334
+
335
+ <sub>`api.ogt` line 6079</sub>
336
+
337
+ <a id="type-Ease"></a>
338
+
339
+ ### `Ease` (enum)
340
+
341
+ An easing curve from the start (0) to the end (1). In starts slow, out ends slow, inOut both. back overshoots, elastic rings, bounce bounces at the end.
342
+
343
+ A string: one of the variants below. The zero value is `"quadOut"`.
344
+
345
+ | Variant | Doc |
346
+ |---|---|
347
+ | `"quadOut"` | Gentle ease out: the default for most motion. |
348
+ | `"linear"` | Constant speed: scrolling, timers, colour cycles. |
349
+ | `"quadIn"` | Gentle ease in. |
350
+ | `"quadInOut"` | Gentle in and out. |
351
+ | `"cubicIn"` | Ease in. |
352
+ | `"cubicOut"` | Ease out: UI sliding in, things settling. |
353
+ | `"cubicInOut"` | In and out: camera moves, deliberate motion. |
354
+ | `"quartIn"` | Strong ease in. |
355
+ | `"quartOut"` | Strong ease out. |
356
+ | `"quartInOut"` | Strong in and out. |
357
+ | `"expoIn"` | Exponential ease in: things falling away, warp-outs. |
358
+ | `"expoOut"` | Exponential ease out: snappy arrivals. |
359
+ | `"expoInOut"` | Exponential in and out. |
360
+ | `"backIn"` | Pulls back first, then goes: anticipation. |
361
+ | `"backOut"` | Overshoots, then settles: pops, squash recovery, buttons. |
362
+ | `"backInOut"` | Pulls back and overshoots. |
363
+ | `"elasticIn"` | Rings before leaving. |
364
+ | `"elasticOut"` | Rings after arriving: springy, cartoon impacts. |
365
+ | `"elasticInOut"` | Rings at both ends. |
366
+ | `"bounceIn"` | Bounces before leaving. |
367
+ | `"bounceOut"` | Bounces at the end: drops, landings. |
368
+ | `"bounceInOut"` | Bounces at both ends. |
369
+
370
+ ```ogt
371
+ enum Ease {
372
+ doc "An easing curve from the start (0) to the end (1). In starts slow, out ends slow, inOut both. back overshoots, elastic rings, bounce bounces at the end."
373
+ variant quadOut "Gentle ease out: the default for most motion."
374
+ variant linear "Constant speed: scrolling, timers, colour cycles."
375
+ variant quadIn "Gentle ease in."
376
+ variant quadInOut "Gentle in and out."
377
+ variant cubicIn "Ease in."
378
+ variant cubicOut "Ease out: UI sliding in, things settling."
379
+ variant cubicInOut "In and out: camera moves, deliberate motion."
380
+ variant quartIn "Strong ease in."
381
+ variant quartOut "Strong ease out."
382
+ variant quartInOut "Strong in and out."
383
+ variant expoIn "Exponential ease in: things falling away, warp-outs."
384
+ variant expoOut "Exponential ease out: snappy arrivals."
385
+ variant expoInOut "Exponential in and out."
386
+ variant backIn "Pulls back first, then goes: anticipation."
387
+ variant backOut "Overshoots, then settles: pops, squash recovery, buttons."
388
+ variant backInOut "Pulls back and overshoots."
389
+ variant elasticIn "Rings before leaving."
390
+ variant elasticOut "Rings after arriving: springy, cartoon impacts."
391
+ variant elasticInOut "Rings at both ends."
392
+ variant bounceIn "Bounces before leaving."
393
+ variant bounceOut "Bounces at the end: drops, landings."
394
+ variant bounceInOut "Bounces at both ends."
395
+ }
396
+ ```
397
+
398
+ <sub>`api.ogt` line 6088</sub>
399
+
400
+ <a id="type-TweenDesc"></a>
401
+
402
+ ### `TweenDesc` (desc struct)
403
+
404
+ One tween of one field.
405
+
406
+ A desc: every field may be omitted and takes its default; `{}` is valid.
407
+
408
+ | Field | Type | Default | Range | Unit | Notes | Doc |
409
+ |---|---|---|---|---|---|---|
410
+ | `entity` | `Entity` | `0` | — | — | — | The entity whose component is tweened. |
411
+ | `component` | `AnyComponent \| null` | `null` | — | — | — | The component token (og.Transform, og.Sprite, a game's own); null is og.Transform. |
412
+ | `field` | `string` | `""` | — | — | — | The field, or one lane of it: `position`, `position.y`, `scale`, `color.r`, `opacity`. f32, f64, i32 and u32 fields (rounded), vectors, colours and quaternions (as a rotation) tween; bool, enum and handle fields do not. |
413
+ | `to` | `readonly number[]` | `[]` | — | — | — | The end value: one number for a scalar or for every lane, or one per lane. |
414
+ | `from` | `readonly number[] \| null` | `null` | — | — | — | The start value, written from the tick the tween is started and held through its delay; null takes the field's value when the tween starts (after its delay). |
415
+ | `relative` | `boolean` | `false` | — | — | — | `to` is added to the start value. |
416
+ | `duration` | `number` | `0.3` | ≥ 0 | `s` | — | Seconds from start to end (one cycle). |
417
+ | `delay` | `number` | `0` | ≥ 0 | `s` | — | Seconds before it starts. |
418
+ | `ease` | `Ease` | `"quadOut"` | — | — | — | The curve. |
419
+ | `loops` | `number` | `0` | ≥ -1 | — | — | Extra cycles: 0 plays once, n repeats n more times, -1 forever. |
420
+ | `yoyo` | `boolean` | `false` | — | — | — | Every other cycle plays backwards (pulses, bobbing). |
421
+ | `unscaled` | `boolean` | `false` | — | — | — | Advance by real ticks, ignoring Time.scale and hit stop (UI motion). |
422
+ | `tag` | `number` | `0` | — | — | — | A number of yours, carried by og.TweenCompleted. |
423
+
424
+ ```ogt
425
+ struct TweenDesc {
426
+ doc "One tween of one field."
427
+ desc true
428
+ field entity Entity "The entity whose component is tweened."
429
+ field component Option.AnyComponent "The component token (og.Transform, og.Sprite, a game's own); null is og.Transform."
430
+ field field String "The field, or one lane of it: `position`, `position.y`, `scale`, `color.r`, `opacity`. f32, f64, i32 and u32 fields (rounded), vectors, colours and quaternions (as a rotation) tween; bool, enum and handle fields do not."
431
+ field to List.f32 "The end value: one number for a scalar or for every lane, or one per lane."
432
+ field from Option.List.f32 "The start value, written from the tick the tween is started and held through its delay; null takes the field's value when the tween starts (after its delay)."
433
+ field relative bool "`to` is added to the start value."
434
+ field duration f32 "Seconds from start to end (one cycle)." {
435
+ default 0.3
436
+ min 0
437
+ unit s
438
+ }
439
+ field delay f32 "Seconds before it starts." {
440
+ min 0
441
+ unit s
442
+ }
443
+ field ease Ease "The curve."
444
+ field loops i32 "Extra cycles: 0 plays once, n repeats n more times, -1 forever." {
445
+ min -1
446
+ }
447
+ field yoyo bool "Every other cycle plays backwards (pulses, bobbing)."
448
+ field unscaled bool "Advance by real ticks, ignoring Time.scale and hit stop (UI motion)."
449
+ field tag u32 "A number of yours, carried by og.TweenCompleted."
450
+ }
451
+ ```
452
+
453
+ <sub>`api.ogt` line 6114</sub>
454
+
455
+ <a id="type-TweenGroupDesc"></a>
456
+
457
+ ### `TweenGroupDesc` (desc struct)
458
+
459
+ How a sequence or parallel group runs.
460
+
461
+ A desc: every field may be omitted and takes its default; `{}` is valid.
462
+
463
+ | Field | Type | Default | Range | Unit | Notes | Doc |
464
+ |---|---|---|---|---|---|---|
465
+ | `loops` | `number` | `0` | ≥ -1 | — | — | Extra runs of the whole group: 0 once, -1 forever; each run replays the spans its tweens resolved in the first. |
466
+ | `unscaled` | `boolean` | `false` | — | — | — | Advance by real ticks, ignoring Time.scale and hit stop. |
467
+ | `tag` | `number` | `0` | — | — | — | A number of yours, carried by og.TweenCompleted. |
468
+
469
+ ```ogt
470
+ struct TweenGroupDesc {
471
+ doc "How a sequence or parallel group runs."
472
+ desc true
473
+ field loops i32 "Extra runs of the whole group: 0 once, -1 forever; each run replays the spans its tweens resolved in the first." {
474
+ min -1
475
+ }
476
+ field unscaled bool "Advance by real ticks, ignoring Time.scale and hit stop."
477
+ field tag u32 "A number of yours, carried by og.TweenCompleted."
478
+ }
479
+ ```
480
+
481
+ <sub>`api.ogt` line 6141</sub>
482
+
483
+ <a id="type-SquashDesc"></a>
484
+
485
+ ### `SquashDesc` (desc struct)
486
+
487
+ Squash and stretch: the entity's og.Transform.scale jumps to rest times impact and eases back to rest.
488
+
489
+ A desc: every field may be omitted and takes its default; `{}` is valid.
490
+
491
+ | Field | Type | Default | Range | Unit | Notes | Doc |
492
+ |---|---|---|---|---|---|---|
493
+ | `entity` | `Entity` | `0` | — | — | — | The entity. |
494
+ | `impact` | `Partial<Vector3>` | `{}` | — | — | — | The x, y and z factors at the impact: (1.25, 0.8) squashes (a landing, a hit), (0.8, 1.25) stretches (a jump). z is for 3D models (a squash bulges in x and z: (1.15, 0.85, 1.15)); left out or 0 it stays at rest, so a sprite's { x, y } is unchanged. A component left out takes its default: x 1.25, y 0.8, z 0. |
495
+ | `rest` | `Vector3` | `{ x: 1, y: 1, z: 1 }` | — | — | — | The scale it recovers to. |
496
+ | `duration` | `number` | `0.18` | ≥ 0 | `s` | — | Seconds to recover. |
497
+ | `ease` | `Ease` | `"backOut"` | — | — | — | The recovery curve; backOut overshoots a little, elasticOut wobbles. |
498
+
499
+ ```ogt
500
+ struct SquashDesc {
501
+ doc "Squash and stretch: the entity's og.Transform.scale jumps to rest times impact and eases back to rest."
502
+ desc true
503
+ field entity Entity "The entity."
504
+ field impact Partial.Vector3 "The x, y and z factors at the impact: (1.25, 0.8) squashes (a landing, a hit), (0.8, 1.25) stretches (a jump). z is for 3D models (a squash bulges in x and z: (1.15, 0.85, 1.15)); left out or 0 it stays at rest, so a sprite's { x, y } is unchanged. A component left out takes its default: x 1.25, y 0.8, z 0."
505
+ field rest Vector3 "The scale it recovers to." {
506
+ default 1 1 1
507
+ }
508
+ field duration f32 "Seconds to recover." {
509
+ default 0.18
510
+ min 0
511
+ unit s
512
+ }
513
+ field ease Ease "The recovery curve; backOut overshoots a little, elasticOut wobbles." {
514
+ default backOut
515
+ }
516
+ }
517
+ ```
518
+
519
+ <sub>`api.ogt` line 6158</sub>
520
+
521
+ <a id="type-FlashDesc"></a>
522
+
523
+ ### `FlashDesc` (desc struct)
524
+
525
+ A hit flash: the entity's og.Sprite (else og.Mesh, else og.Model) flashColor set and its flash faded from amount to 0.
526
+
527
+ A desc: every field may be omitted and takes its default; `{}` is valid.
528
+
529
+ | Field | Type | Default | Range | Unit | Notes | Doc |
530
+ |---|---|---|---|---|---|---|
531
+ | `entity` | `Entity` | `0` | — | — | — | The entity. |
532
+ | `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The flash colour (white for a hit, red for damage taken). |
533
+ | `amount` | `number` | `1` | 0 … 1 | — | — | How far it starts towards the colour. |
534
+ | `duration` | `number` | `0.12` | ≥ 0 | `s` | — | Seconds to fade. |
535
+ | `ease` | `Ease` | `"quadIn"` | — | — | — | The fade's curve; quadIn holds the flash, then drops it. |
536
+
537
+ ```ogt
538
+ struct FlashDesc {
539
+ doc "A hit flash: the entity's og.Sprite (else og.Mesh, else og.Model) flashColor set and its flash faded from amount to 0."
540
+ desc true
541
+ field entity Entity "The entity."
542
+ field color Color "The flash colour (white for a hit, red for damage taken)." {
543
+ default 1 1 1
544
+ }
545
+ field amount f32 "How far it starts towards the colour." {
546
+ default 1
547
+ min 0
548
+ max 1
549
+ }
550
+ field duration f32 "Seconds to fade." {
551
+ default 0.12
552
+ min 0
553
+ unit s
554
+ }
555
+ field ease Ease "The fade's curve; quadIn holds the flash, then drops it." {
556
+ default quadIn
557
+ }
558
+ }
559
+ ```
560
+
561
+ <sub>`api.ogt` line 6176</sub>
562
+
563
+ ## Column kinds
564
+
565
+ Each is a factory, `Tween(value?, options?)`, that makes one field of a component or resource layout.
566
+
567
+ | Column | Value | Typed array | Stride | Doc |
568
+ |---|---|---|---|---|
569
+ | <a id="column-Tween"></a>`Tween` | `Tween` | `Uint32Array` | 2 | A Tween handle field. |
570
+
571
+ ```ogt
572
+ column Tween {
573
+ doc "A Tween handle field."
574
+ array Uint32Array
575
+ stride 2
576
+ value Tween
577
+ }
578
+ ```
579
+
580
+ <sub>`api.ogt` line 6081</sub>