lecodes-sdk 0.19.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.
- package/README.md +114 -0
- package/dist/global.d.ts +503 -0
- package/dist/host.d.ts +61 -0
- package/dist/inject.js +4730 -0
- package/dist/types/animate/animate.d.ts +20 -0
- package/dist/types/animate/bezier.d.ts +2 -0
- package/dist/types/animate/easings.d.ts +21 -0
- package/dist/types/canvas/Canvas.d.ts +168 -0
- package/dist/types/core/Aspect.d.ts +171 -0
- package/dist/types/core/InspectorUI.d.ts +88 -0
- package/dist/types/core/StateMachine.d.ts +81 -0
- package/dist/types/core/color.d.ts +13 -0
- package/dist/types/core/compWrite.d.ts +11 -0
- package/dist/types/core/events.d.ts +11 -0
- package/dist/types/core/fields.d.ts +58 -0
- package/dist/types/core/registry.d.ts +7 -0
- package/dist/types/core/signals.d.ts +29 -0
- package/dist/types/core/time.d.ts +31 -0
- package/dist/types/g2/Camera2D.d.ts +19 -0
- package/dist/types/g2/CharacterController2D.d.ts +134 -0
- package/dist/types/g2/Node2D.d.ts +91 -0
- package/dist/types/g2/OneWay2D.d.ts +24 -0
- package/dist/types/g2/Physics2D.d.ts +147 -0
- package/dist/types/g2/Scene2D.d.ts +72 -0
- package/dist/types/g2/Shape2D.d.ts +58 -0
- package/dist/types/g2/Sprite.d.ts +51 -0
- package/dist/types/g2/SpriteAnimation.d.ts +50 -0
- package/dist/types/g2/SpriteSheet.d.ts +69 -0
- package/dist/types/g2/Texture2D.d.ts +16 -0
- package/dist/types/g2/Tilemap.d.ts +20 -0
- package/dist/types/g2/Tileset.d.ts +32 -0
- package/dist/types/g2/Trigger2D.d.ts +20 -0
- package/dist/types/g2/autotile.d.ts +133 -0
- package/dist/types/g2/cells.d.ts +14 -0
- package/dist/types/g2/defineScene2d.d.ts +141 -0
- package/dist/types/g2/groups2d.d.ts +16 -0
- package/dist/types/g2/loop.d.ts +4 -0
- package/dist/types/g2/scenarios2d.d.ts +30 -0
- package/dist/types/g2/touch.d.ts +2 -0
- package/dist/types/gl/Camera.d.ts +79 -0
- package/dist/types/gl/CameraPlace.d.ts +26 -0
- package/dist/types/gl/CharacterController.d.ts +98 -0
- package/dist/types/gl/Gearbox.d.ts +86 -0
- package/dist/types/gl/Geometry.d.ts +39 -0
- package/dist/types/gl/IK.d.ts +53 -0
- package/dist/types/gl/InstancedMesh.d.ts +46 -0
- package/dist/types/gl/Light.d.ts +73 -0
- package/dist/types/gl/Lightmap.d.ts +85 -0
- package/dist/types/gl/Locomotion.d.ts +279 -0
- package/dist/types/gl/Material.d.ts +100 -0
- package/dist/types/gl/Mesh.d.ts +33 -0
- package/dist/types/gl/Model.d.ts +53 -0
- package/dist/types/gl/NavAgent.d.ts +99 -0
- package/dist/types/gl/NavMesh.d.ts +169 -0
- package/dist/types/gl/Node.d.ts +99 -0
- package/dist/types/gl/Noise.d.ts +20 -0
- package/dist/types/gl/Particles.d.ts +277 -0
- package/dist/types/gl/Physics.d.ts +91 -0
- package/dist/types/gl/Plane.d.ts +19 -0
- package/dist/types/gl/Ragdoll.d.ts +86 -0
- package/dist/types/gl/Ray.d.ts +8 -0
- package/dist/types/gl/Scene.d.ts +221 -0
- package/dist/types/gl/Shape.d.ts +122 -0
- package/dist/types/gl/Terrain.d.ts +280 -0
- package/dist/types/gl/Texture.d.ts +27 -0
- package/dist/types/gl/Trigger.d.ts +10 -0
- package/dist/types/gl/Vehicle.d.ts +191 -0
- package/dist/types/gl/Wheel.d.ts +95 -0
- package/dist/types/gl/animation/AnimationClip.d.ts +60 -0
- package/dist/types/gl/animation/Animator.d.ts +219 -0
- package/dist/types/gl/animation/Layer.d.ts +31 -0
- package/dist/types/gl/animation/Loop.d.ts +17 -0
- package/dist/types/gl/animation/Playback.d.ts +36 -0
- package/dist/types/gl/animation/core.d.ts +367 -0
- package/dist/types/gl/controls.d.ts +19 -0
- package/dist/types/gl/physicsEvents.d.ts +1 -0
- package/dist/types/gl/scenarios.d.ts +98 -0
- package/dist/types/gl/state.d.ts +5 -0
- package/dist/types/gl/terrainMesh.d.ts +46 -0
- package/dist/types/gl/touch.d.ts +2 -0
- package/dist/types/inject.d.ts +123 -0
- package/dist/types/math/Mathf.d.ts +39 -0
- package/dist/types/math/mat4.d.ts +66 -0
- package/dist/types/math/quat.d.ts +53 -0
- package/dist/types/math/vec.d.ts +129 -0
- package/dist/types/net/codec.d.ts +25 -0
- package/dist/types/net/core.d.ts +106 -0
- package/dist/types/net/index.d.ts +80 -0
- package/dist/types/net/replication.d.ts +101 -0
- package/dist/types/plugins/camera.d.ts +25 -0
- package/dist/types/plugins/geolocation.d.ts +39 -0
- package/dist/types/plugins/oauth.d.ts +25 -0
- package/dist/types/plugins/permission.d.ts +1 -0
- package/dist/types/plugins/push.d.ts +46 -0
- package/dist/types/plugins/qr.d.ts +21 -0
- package/dist/types/plugins/service.d.ts +33 -0
- package/dist/types/runtime/app.d.ts +67 -0
- package/dist/types/runtime/appEvents.d.ts +7 -0
- package/dist/types/runtime/channel.d.ts +1 -0
- package/dist/types/runtime/clipboard.d.ts +7 -0
- package/dist/types/runtime/datetime.d.ts +80 -0
- package/dist/types/runtime/device.d.ts +126 -0
- package/dist/types/runtime/fetch.d.ts +31 -0
- package/dist/types/runtime/files.d.ts +33 -0
- package/dist/types/runtime/input.d.ts +121 -0
- package/dist/types/runtime/media.d.ts +46 -0
- package/dist/types/runtime/misc.d.ts +11 -0
- package/dist/types/runtime/net.d.ts +15 -0
- package/dist/types/runtime/rpc.d.ts +44 -0
- package/dist/types/runtime/service.d.ts +1 -0
- package/dist/types/runtime/share.d.ts +2 -0
- package/dist/types/runtime/storage.d.ts +5 -0
- package/dist/types/runtime/touch.d.ts +56 -0
- package/dist/types/scene/defineScene.d.ts +296 -0
- package/dist/types/scene/editorPlugins.d.ts +82 -0
- package/dist/types/scene/gizmos.d.ts +56 -0
- package/dist/types/scene/grammar.d.ts +56 -0
- package/dist/types/scene/level.d.ts +98 -0
- package/dist/types/scene/material.d.ts +76 -0
- package/dist/types/server/auth/appConfig.d.ts +16 -0
- package/dist/types/server/auth/global.d.ts +56 -0
- package/dist/types/server/auth/models.d.ts +164 -0
- package/dist/types/server/auth/types.d.ts +56 -0
- package/dist/types/server/channel.d.ts +28 -0
- package/dist/types/server/context.d.ts +27 -0
- package/dist/types/server/db/defineDb.d.ts +36 -0
- package/dist/types/server/db/fields.d.ts +146 -0
- package/dist/types/server/db/index.d.ts +6 -0
- package/dist/types/server/db/marci/query.d.ts +326 -0
- package/dist/types/server/db/types.d.ts +163 -0
- package/dist/types/server/errors.d.ts +8 -0
- package/dist/types/server/inject.d.ts +5 -0
- package/dist/types/ui/NativeView.d.ts +38 -0
- package/dist/types/ui/UI.d.ts +27 -0
- package/dist/types/ui/UIBottomSheet.d.ts +71 -0
- package/dist/types/ui/UIButton.d.ts +30 -0
- package/dist/types/ui/UIContainer.d.ts +33 -0
- package/dist/types/ui/UIImage.d.ts +35 -0
- package/dist/types/ui/UIInput.d.ts +110 -0
- package/dist/types/ui/UIModal.d.ts +70 -0
- package/dist/types/ui/UINode.d.ts +363 -0
- package/dist/types/ui/UIPager.d.ts +123 -0
- package/dist/types/ui/UIPopover.d.ts +39 -0
- package/dist/types/ui/UIScreen.d.ts +57 -0
- package/dist/types/ui/UIScrollable.d.ts +40 -0
- package/dist/types/ui/UISpacer.d.ts +9 -0
- package/dist/types/ui/UITabs.d.ts +96 -0
- package/dist/types/ui/UIText.d.ts +19 -0
- package/dist/types/ui/UIVideo.d.ts +28 -0
- package/dist/types/ui/UIVirtualizedList.d.ts +97 -0
- package/dist/types/ui/UIWidget.d.ts +65 -0
- package/dist/types/ui/fonts.d.ts +9 -0
- package/dist/types/ui/presentable.d.ts +68 -0
- package/dist/types/ui/router.d.ts +40 -0
- package/dist/types/ui/theme.d.ts +26 -0
- package/dist/types.json +1 -0
- package/package.json +46 -0
- package/prompts/2d.md +395 -0
- package/prompts/3d-scene-files.md +113 -0
- package/prompts/3d-scene.md +119 -0
- package/prompts/3d.md +303 -0
- package/prompts/README.md +142 -0
- package/prompts/ar.md +109 -0
- package/prompts/canvas.md +27 -0
- package/prompts/compose.ts +46 -0
- package/prompts/concept.md +49 -0
- package/prompts/core-design.md +75 -0
- package/prompts/core.md +264 -0
- package/prompts/design.md +218 -0
- package/prompts/dist/2d-game.md +1530 -0
- package/prompts/dist/3d-app.md +1672 -0
- package/prompts/dist/ar-app.md +1548 -0
- package/prompts/dist/concept.md +49 -0
- package/prompts/dist/design.md +498 -0
- package/prompts/dist/ui-app.md +1134 -0
- package/prompts/index.md +37 -0
- package/prompts/intake-prompt.md +33 -0
- package/prompts/namer-prompt.md +12 -0
- package/prompts/router-prompt.md +50 -0
- package/prompts/select.ts +111 -0
- package/prompts/ui-design.md +203 -0
- package/prompts/ui.md +803 -0
- package/src/animate/animate.ts +238 -0
- package/src/animate/bezier.ts +138 -0
- package/src/animate/easings.ts +126 -0
- package/src/bridges.d.ts +1345 -0
- package/src/canvas/Canvas.ts +305 -0
- package/src/compile/__tests__/assetIconMacro.test.ts +219 -0
- package/src/compile/__tests__/assetMacro.test.ts +74 -0
- package/src/compile/__tests__/assetName.test.ts +55 -0
- package/src/compile/__tests__/compile.test.ts +287 -0
- package/src/compile/__tests__/detectEntry.test.ts +132 -0
- package/src/compile/__tests__/fontMacro.test.ts +199 -0
- package/src/compile/aspectMacro.ts +86 -0
- package/src/compile/assetIconMacro.ts +384 -0
- package/src/compile/assetMacro.ts +146 -0
- package/src/compile/assetName.ts +50 -0
- package/src/compile/bundler.ts +287 -0
- package/src/compile/compileProject.ts +127 -0
- package/src/compile/detectEntry.ts +128 -0
- package/src/compile/fontMacro.ts +459 -0
- package/src/compile/fontRegistry.ts +78 -0
- package/src/compile/header.ts +67 -0
- package/src/compile/index.ts +100 -0
- package/src/compile/libraryImports.ts +52 -0
- package/src/compile/liteMaterial.ts +247 -0
- package/src/compile/sceneEditor.ts +88 -0
- package/src/compile/serverSplit.ts +233 -0
- package/src/compile/serverTypes.ts +227 -0
- package/src/compile/sfnt.ts +98 -0
- package/src/compile/shaderSchema.ts +202 -0
- package/src/compile/shaderTargets.ts +77 -0
- package/src/compile/sourcemap.ts +25 -0
- package/src/core/Aspect.ts +568 -0
- package/src/core/InspectorUI.ts +212 -0
- package/src/core/StateMachine.ts +308 -0
- package/src/core/__tests__/stateMachine.test.ts +132 -0
- package/src/core/color.ts +66 -0
- package/src/core/compWrite.ts +42 -0
- package/src/core/events.ts +38 -0
- package/src/core/fields.ts +120 -0
- package/src/core/registry.ts +23 -0
- package/src/core/signals.ts +277 -0
- package/src/core/time.ts +84 -0
- package/src/g2/Camera2D.ts +40 -0
- package/src/g2/CharacterController2D.ts +276 -0
- package/src/g2/Node2D.ts +267 -0
- package/src/g2/OneWay2D.ts +66 -0
- package/src/g2/Physics2D.ts +346 -0
- package/src/g2/Scene2D.ts +209 -0
- package/src/g2/Shape2D.ts +259 -0
- package/src/g2/Sprite.ts +89 -0
- package/src/g2/SpriteAnimation.ts +171 -0
- package/src/g2/SpriteSheet.ts +166 -0
- package/src/g2/Texture2D.ts +47 -0
- package/src/g2/Tilemap.ts +41 -0
- package/src/g2/Tileset.ts +71 -0
- package/src/g2/Trigger2D.ts +77 -0
- package/src/g2/autotile.ts +433 -0
- package/src/g2/cells.ts +91 -0
- package/src/g2/defineScene2d.ts +381 -0
- package/src/g2/groups2d.ts +106 -0
- package/src/g2/loop.ts +50 -0
- package/src/g2/scenarios2d.ts +69 -0
- package/src/g2/touch.ts +83 -0
- package/src/gl/Camera.ts +160 -0
- package/src/gl/CameraPlace.ts +52 -0
- package/src/gl/CharacterController.ts +238 -0
- package/src/gl/Gearbox.ts +212 -0
- package/src/gl/Geometry.ts +279 -0
- package/src/gl/IK.ts +193 -0
- package/src/gl/InstancedMesh.ts +132 -0
- package/src/gl/Light.ts +135 -0
- package/src/gl/Lightmap.ts +402 -0
- package/src/gl/Locomotion.ts +498 -0
- package/src/gl/Material.ts +279 -0
- package/src/gl/Mesh.ts +83 -0
- package/src/gl/Model.ts +124 -0
- package/src/gl/NavAgent.ts +337 -0
- package/src/gl/NavMesh.ts +397 -0
- package/src/gl/Node.ts +350 -0
- package/src/gl/Noise.ts +30 -0
- package/src/gl/Particles.ts +676 -0
- package/src/gl/Physics.ts +222 -0
- package/src/gl/Plane.ts +53 -0
- package/src/gl/Ragdoll.ts +270 -0
- package/src/gl/Ray.ts +16 -0
- package/src/gl/Scene.ts +505 -0
- package/src/gl/Shape.ts +409 -0
- package/src/gl/Terrain.ts +1092 -0
- package/src/gl/Texture.ts +63 -0
- package/src/gl/Trigger.ts +45 -0
- package/src/gl/Vehicle.ts +473 -0
- package/src/gl/Wheel.ts +240 -0
- package/src/gl/animation/AnimationClip.ts +204 -0
- package/src/gl/animation/Animator.ts +329 -0
- package/src/gl/animation/Layer.ts +39 -0
- package/src/gl/animation/Loop.ts +31 -0
- package/src/gl/animation/Playback.ts +52 -0
- package/src/gl/animation/core.ts +670 -0
- package/src/gl/controls.ts +95 -0
- package/src/gl/physicsEvents.ts +20 -0
- package/src/gl/scenarios.ts +291 -0
- package/src/gl/state.ts +6 -0
- package/src/gl/terrainMesh.ts +219 -0
- package/src/gl/touch.ts +68 -0
- package/src/host.d.ts +61 -0
- package/src/inject.ts +203 -0
- package/src/math/Mathf.ts +118 -0
- package/src/math/mat4.ts +278 -0
- package/src/math/quat.ts +232 -0
- package/src/math/vec.ts +255 -0
- package/src/net/codec.ts +119 -0
- package/src/net/core.ts +384 -0
- package/src/net/index.ts +181 -0
- package/src/net/replication.ts +622 -0
- package/src/plugins/camera.ts +81 -0
- package/src/plugins/geolocation.ts +123 -0
- package/src/plugins/oauth.ts +61 -0
- package/src/plugins/permission.ts +7 -0
- package/src/plugins/push.ts +132 -0
- package/src/plugins/qr.ts +73 -0
- package/src/plugins/service.ts +47 -0
- package/src/runtime/app.ts +101 -0
- package/src/runtime/appEvents.ts +54 -0
- package/src/runtime/channel.ts +61 -0
- package/src/runtime/clipboard.ts +20 -0
- package/src/runtime/datetime.ts +329 -0
- package/src/runtime/device.ts +293 -0
- package/src/runtime/fetch.ts +77 -0
- package/src/runtime/files.ts +108 -0
- package/src/runtime/input.ts +175 -0
- package/src/runtime/media.ts +111 -0
- package/src/runtime/misc.ts +16 -0
- package/src/runtime/net.ts +36 -0
- package/src/runtime/rpc.ts +218 -0
- package/src/runtime/service.ts +83 -0
- package/src/runtime/share.ts +9 -0
- package/src/runtime/storage.ts +13 -0
- package/src/runtime/touch.ts +76 -0
- package/src/scene/defineScene.ts +1396 -0
- package/src/scene/editorPlugins.ts +110 -0
- package/src/scene/gizmos.ts +148 -0
- package/src/scene/grammar.ts +120 -0
- package/src/scene/level.ts +296 -0
- package/src/scene/material.ts +188 -0
- package/src/server/auth/appConfig.ts +12 -0
- package/src/server/auth/global.ts +80 -0
- package/src/server/auth/host.ts +318 -0
- package/src/server/auth/models.ts +83 -0
- package/src/server/auth/types.ts +50 -0
- package/src/server/channel.ts +56 -0
- package/src/server/context.ts +36 -0
- package/src/server/db/defineDb.ts +237 -0
- package/src/server/db/fields.ts +132 -0
- package/src/server/db/httpTransport.ts +93 -0
- package/src/server/db/index.ts +7 -0
- package/src/server/db/marci/query.ts +412 -0
- package/src/server/db/types.ts +202 -0
- package/src/server/errors.ts +12 -0
- package/src/server/host.ts +74 -0
- package/src/server/inject.ts +13 -0
- package/src/server/runtime.ts +133 -0
- package/src/server/validate.ts +87 -0
- package/src/ui/NativeView.ts +142 -0
- package/src/ui/UI.ts +39 -0
- package/src/ui/UIBottomSheet.ts +139 -0
- package/src/ui/UIButton.ts +101 -0
- package/src/ui/UIContainer.ts +60 -0
- package/src/ui/UIImage.ts +83 -0
- package/src/ui/UIInput.ts +185 -0
- package/src/ui/UIModal.ts +139 -0
- package/src/ui/UINode.ts +830 -0
- package/src/ui/UIPager.ts +362 -0
- package/src/ui/UIPopover.ts +100 -0
- package/src/ui/UIScreen.ts +123 -0
- package/src/ui/UIScrollable.ts +87 -0
- package/src/ui/UISpacer.ts +14 -0
- package/src/ui/UITabs.ts +236 -0
- package/src/ui/UIText.ts +51 -0
- package/src/ui/UIVideo.ts +88 -0
- package/src/ui/UIVirtualizedList.ts +241 -0
- package/src/ui/UIWidget.ts +127 -0
- package/src/ui/fonts.ts +13 -0
- package/src/ui/presentable.ts +117 -0
- package/src/ui/router.ts +132 -0
- package/src/ui/theme.ts +84 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Aspect } from "../../core/Aspect";
|
|
2
|
+
import { Vec3 } from "../../math/vec";
|
|
3
|
+
import type { Node } from "../Node";
|
|
4
|
+
import type { AnimationClip } from "./AnimationClip";
|
|
5
|
+
import { type ActiveClip, type ClipCurves, type ClipEventHandler, type KneeAxisReport, type LayerOptions, type LoopDef, type LoopOptions, type PlayOptions, type StepHandler, type StopOptions } from "./core";
|
|
6
|
+
import type { Loop } from "./Loop";
|
|
7
|
+
import type { Layer } from "./Layer";
|
|
8
|
+
import type { Playback } from "./Playback";
|
|
9
|
+
/** Level of detail for a GLB instance (docs/lod-plan.md): `'auto'` = the engine's pick by screen size and
|
|
10
|
+
* visibility, or a fixed level 0 (full) … 3 (coarsest mesh, animation every 4th frame without fingers). */
|
|
11
|
+
export type LodMode = "auto" | 0 | 1 | 2 | 3;
|
|
12
|
+
/** What `Animator.warp` turns on. Speeds are m/s, angles degrees, distances metres. */
|
|
13
|
+
export type WarpOptions = {
|
|
14
|
+
/** Fit the stride to the speed the body actually travels at. `[min, max]` clamps the scale
|
|
15
|
+
* (default 0.85…1.2). It is a CORRECTION: a pack whose takes already read right at the speeds it
|
|
16
|
+
* is played at wants none of this, and a wide range only lets the legs be stretched into shapes
|
|
17
|
+
* nobody recorded. Open it for a pack that must cover speeds it was never recorded at. */
|
|
18
|
+
stride?: boolean | [number, number];
|
|
19
|
+
/** Turn the lower body toward where the body really travels; a number caps the turn in degrees
|
|
20
|
+
* (default 20). The spine counter-turns, so the chest keeps facing where it faced — the whole twist
|
|
21
|
+
* lives in one joint, which is why a few degrees read as a lean and a lot reads as a broken back.
|
|
22
|
+
* Only applied while the gait LOOP shows: a start, a turn or a stop walks a path of its own. */
|
|
23
|
+
orientation?: boolean | number;
|
|
24
|
+
/** Below this speed — the game's or the clip's — both warps are off (default 0.2). */
|
|
25
|
+
minSpeed?: number;
|
|
26
|
+
/** How far the pelvis may drop to keep a stretched leg from locking straight (default 0.25). */
|
|
27
|
+
pelvis?: number;
|
|
28
|
+
/** The stride scale's own spring, seconds (default 0.15). The body's speed is continuous but the
|
|
29
|
+
* shown clip's recorded one steps at every switch, so the scale is smoothed rather than followed. */
|
|
30
|
+
strideTime?: number;
|
|
31
|
+
};
|
|
32
|
+
/** What `Animator.feet` sets: which bones the feet are, and what the engine does with them. Distances
|
|
33
|
+
* are metres, times seconds. Every key is optional and only the keys given change — set the bones
|
|
34
|
+
* once, switch the lock on somewhere else. */
|
|
35
|
+
export type FeetOptions = {
|
|
36
|
+
/** The contact bones per side — `'LeftFoot'`, or with a toe / ball `['LeftFoot', 'LeftToeBase']`.
|
|
37
|
+
* Default: classified from the bone names (Mixamo / Unity / Blender / UE). Set them for a rig the
|
|
38
|
+
* classifier misses; it re-bakes every clip's contacts and phase. */
|
|
39
|
+
left?: string | string[];
|
|
40
|
+
right?: string | string[];
|
|
41
|
+
/** FOOT LOCK: a foot the shown clip calls planted (its baked contacts, else a runtime detector) is
|
|
42
|
+
* pinned where it landed — heel to ball, rolling as the clip rolls — and the leg re-solved to keep it
|
|
43
|
+
* there while the body moves on. What hides the last of a transition's slide: the pose the new clip
|
|
44
|
+
* starts from is not the one the old clip ended in, and the difference used to be dragged out of
|
|
45
|
+
* the standing foot over the blend. Off by default; a `Locomotion` turns it on. */
|
|
46
|
+
lock?: boolean;
|
|
47
|
+
/** GROUND IK: each foot is put on the ground the engine probes under it (stairs, a slope, a kerb),
|
|
48
|
+
* aligned to its normal, and the pelvis lowered so the lower leg can reach — the feet stop hanging
|
|
49
|
+
* in the air on a step down and sinking into a step up. Needs a physics world to probe; without
|
|
50
|
+
* one the ground is the node's own plane. Off by default. */
|
|
51
|
+
ik?: boolean;
|
|
52
|
+
/** How far the pelvis may drop for the ground (default 0.35). */
|
|
53
|
+
pelvis?: number;
|
|
54
|
+
/** The anchor's leash: a locked foot never absorbs more residual than this — beyond it the anchor
|
|
55
|
+
* follows the animation instead of fighting it (default 0.10). */
|
|
56
|
+
unlockDistance?: number;
|
|
57
|
+
/** The lock's ease in / out, seconds (default 0.08 / 0.12). */
|
|
58
|
+
lockIn?: number;
|
|
59
|
+
lockOut?: number;
|
|
60
|
+
/** 0..1: how much the foot tilts onto the ground normal (default 1). */
|
|
61
|
+
align?: number;
|
|
62
|
+
/** The probe ray's reach above and below the ankle (default 0.6) — a step taller than this is a
|
|
63
|
+
* hole to the probe. */
|
|
64
|
+
probe?: number;
|
|
65
|
+
/** The lock plants only once the animated ankle moves slower than this, m/s (default 0.2: a foot
|
|
66
|
+
* the take itself holds still). Raise it to pin a foot a transition is still dragging — a run
|
|
67
|
+
* entered from standing lands its first foot while the offset from the idle still decays. */
|
|
68
|
+
plantSpeed?: number;
|
|
69
|
+
};
|
|
70
|
+
/** One foot after this frame's evaluation (`Animator.foot`): whether the lock holds it, the lock's
|
|
71
|
+
* weight (eased 0…1), where it was pinned and where the leg was asked to put the ankle — all world. */
|
|
72
|
+
export type FootState = {
|
|
73
|
+
locked: boolean;
|
|
74
|
+
weight: number;
|
|
75
|
+
anchor: Vec3;
|
|
76
|
+
target: Vec3;
|
|
77
|
+
};
|
|
78
|
+
export declare class Animator extends Aspect<"anim", Node> {
|
|
79
|
+
static readonly aspect = "anim";
|
|
80
|
+
private _c;
|
|
81
|
+
private _rootMotion;
|
|
82
|
+
private _rootRotation;
|
|
83
|
+
/** Animation level of detail. `'auto'` (default): a character small on screen or out of view is
|
|
84
|
+
* evaluated every 2nd / 4th frame and stops sampling its finger, toe and twist joints; `'full'`:
|
|
85
|
+
* every frame, every joint, whatever the distance — a hero seen through a scope, a cutscene actor.
|
|
86
|
+
* Independent of `Model.lod` (the mesh level). No-op on hosts without the LOD pass. */
|
|
87
|
+
get lod(): "auto" | "full";
|
|
88
|
+
set lod(v: "auto" | "full");
|
|
89
|
+
onAttach(): void;
|
|
90
|
+
onDetach(): void;
|
|
91
|
+
/** The clip list, in order: the GLB's embedded clips (file order), then the clips you added. An
|
|
92
|
+
* added clip with an embedded clip's name takes its place. */
|
|
93
|
+
get clips(): readonly AnimationClip[];
|
|
94
|
+
/** One clip by name, or by index into `clips` — e.g. to `slice()` it. `undefined` if there is none. */
|
|
95
|
+
clip(ref: string | number): AnimationClip | undefined;
|
|
96
|
+
/** Add a clip under a name (default: its own `name`) — from another file, procedural, or sliced.
|
|
97
|
+
* Overrides an embedded clip of the same name. Chainable. */
|
|
98
|
+
addClip(name: string | AnimationClip, clip?: AnimationClip): this;
|
|
99
|
+
/** Play a one-shot on the base layer — by name, index, or the first clip with no argument. It
|
|
100
|
+
* takes the layer over from whatever it showed, transitioned over `fade` (default 0.2 s).
|
|
101
|
+
* Returns a Playback: `await` it — it resolves at the clip's hand-over (`true`; `false` if cut
|
|
102
|
+
* short), and what you start right after is what the clip hands the layer to (another one-shot,
|
|
103
|
+
* `playLoop(next)`; nothing = back to the loop). */
|
|
104
|
+
play(clip?: string | number, options?: PlayOptions): Playback;
|
|
105
|
+
/** Set the base layer's LOOP — what it shows when no one-shot plays: a clip (`playLoop('Idle')`) or
|
|
106
|
+
* a blend space (`playLoop({ Idle: 0, Run: 6 })`, drive the returned object's `value`). Takes the
|
|
107
|
+
* layer over from whatever plays — a one-shot included (it is cut short) — transitioned over
|
|
108
|
+
* `fade`. `stop()` removes it. */
|
|
109
|
+
playLoop(def: LoopDef, options?: LoopOptions): Loop | undefined;
|
|
110
|
+
/** Fade everything out, on every layer (loops included) → rest pose. */
|
|
111
|
+
stop(options?: StopOptions): this;
|
|
112
|
+
/** The base layer's current loop (the object the last `playLoop()` returned), if any. */
|
|
113
|
+
get loop(): Loop | undefined;
|
|
114
|
+
/** A one-shot on the base layer hasn't handed over yet. */
|
|
115
|
+
get busy(): boolean;
|
|
116
|
+
/** What every layer shows this frame with its weight: one one-shot, or a loop's members with their
|
|
117
|
+
* blend shares (a debug overlay's list). */
|
|
118
|
+
get active(): ActiveClip[];
|
|
119
|
+
/** Where the base layer is in the GAIT CYCLE: 0 at a left-foot-down, 0.5 at a right-foot-down,
|
|
120
|
+
* whether a loop or a one-shot shows it. -1 when what plays has no cycle (an idle, a hit reaction).
|
|
121
|
+
* This is the number `play(clip, { phase: 'match' })` matches against. */
|
|
122
|
+
get phase(): number;
|
|
123
|
+
/** The native animator's id — 0 until something is played or bound. Engine-facing code only. */
|
|
124
|
+
get _id(): number;
|
|
125
|
+
/** Bind a clip to the base layer without playing it and return its native slot (-1 = no such clip);
|
|
126
|
+
* creates the native animator on first use. What a Locomotion registers its set with. */
|
|
127
|
+
_slot(clip: string | number): number;
|
|
128
|
+
/** What the engine measured on a clip once it was bound to this skeleton: foot contacts, the gait
|
|
129
|
+
* phase φ(t), and the root's travel / yaw / speed — a controller reads these instead of shipping
|
|
130
|
+
* measured tables. Binds the clip on first ask. `undefined` if there is no such clip. */
|
|
131
|
+
curves(clip: string | number): ClipCurves | undefined;
|
|
132
|
+
/** The skeleton's calibrated KNEE HINGE AXIS for a side (thigh-local, unit) with its confidence
|
|
133
|
+
* report — measured once over every bound clip's knee rotation track; the ground truth
|
|
134
|
+
* `curves(clip).kneePoleAt` predicts bend planes from. Undefined = no leg chain, or no knee
|
|
135
|
+
* motion bound to calibrate from. */
|
|
136
|
+
kneeAxis(side: "left" | "right"): KneeAxisReport | undefined;
|
|
137
|
+
/** STEP WARP v2 knobs (the warp rewrite): `stride` scales each foot's travel-direction offset
|
|
138
|
+
* from its hip (the step shortens / lengthens), `lift` = metres ADDED to its height
|
|
139
|
+
* (swing-gated; 0 = neutral, negative = a shuffle; half of what it adds raises the pelvis —
|
|
140
|
+
* the body steps higher with the foot), `pitch` (degrees, + = toes up) rotates each foot about
|
|
141
|
+
* its lateral axis, `slope` (degrees, + = ascending) the invisible staircase — feet on the
|
|
142
|
+
* incline + auto pitch; raise the character by tan(slope) × the stride-scaled clip travel to
|
|
143
|
+
* hold each planted foot on its tread. Solved in the calibrated knee hinge plane.
|
|
144
|
+
* Omit / null = off. A tuning bench's dial — locomotion will drive this itself later. */
|
|
145
|
+
setStepWarp(options?: {
|
|
146
|
+
stride?: number;
|
|
147
|
+
lift?: number;
|
|
148
|
+
pitch?: number;
|
|
149
|
+
slope?: number;
|
|
150
|
+
} | null): void;
|
|
151
|
+
/** Scrub: set `clip`'s playhead directly, seconds — for inspectors and debug boards (pair with
|
|
152
|
+
* `speed = 0`). The clip should be the one showing; nothing is faded or re-picked. */
|
|
153
|
+
seek(clip: string | number, time: number): void;
|
|
154
|
+
/** `clip`'s current playhead, seconds (-1 = not bound). */
|
|
155
|
+
time(clip: string | number): number;
|
|
156
|
+
/** Re-aim a playing turn clip's warp (`play({ turn })`) to `deg` for the whole clip — the scale lands on what is
|
|
157
|
+
* still to come; `undefined` = off. */
|
|
158
|
+
setTurn(clip: string | number, deg: number | undefined): void;
|
|
159
|
+
/** THE FEET (docs/animation-v2-plan.md §2.9): which bones they are, and what the engine does with
|
|
160
|
+
* them after the clips are composited — the foot LOCK (a planted foot stays where it landed while the
|
|
161
|
+
* body moves on) and GROUND IK (each foot on the ground probed under it, the pelvis lowered). Only
|
|
162
|
+
* the keys given change, so the bones and the behaviour can be set from different places:
|
|
163
|
+
*
|
|
164
|
+
* model.anim.feet = { left: 'LeftFoot', right: 'RightFoot' } // a rig the classifier misses
|
|
165
|
+
* model.anim.feet = { lock: true } // (a Locomotion does this itself)
|
|
166
|
+
* model.anim.feet = { lock: true, ik: true, pelvis: 0.3 } // stairs and slopes
|
|
167
|
+
*
|
|
168
|
+
* The engine probes the ground itself (against what a character can stand on) and reads the
|
|
169
|
+
* CharacterController's ground state; nothing is fed per frame. See `FeetOptions`. */
|
|
170
|
+
set feet(f: FeetOptions);
|
|
171
|
+
private readonly _feetOpts;
|
|
172
|
+
/** One foot's state after this frame's evaluation — where the lock holds it and with what weight
|
|
173
|
+
* (a debug beam under the foot). `undefined` on a host without the feet stage, or before anything
|
|
174
|
+
* played. */
|
|
175
|
+
foot(side: "left" | "right"): FootState | undefined;
|
|
176
|
+
/** WARPING (docs/animation-v2-plan.md §2.7) — the pose is fitted to what the body actually does,
|
|
177
|
+
* after the clips are composited and before the feet:
|
|
178
|
+
*
|
|
179
|
+
* `stride` — each leg's hip→foot vector is scaled ALONG the travel direction by the ratio of the
|
|
180
|
+
* game speed to the shown clip's own (clamped, default 0.6…1.5), the foot height kept, and the
|
|
181
|
+
* pelvis lowered when that would overextend a leg. A walk played at 1.9 m/s stops skating; a
|
|
182
|
+
* speed between two gaits becomes continuous instead of "two clips and a crossfade".
|
|
183
|
+
* `orientation` — the lower body turns from the clip's travel direction toward the one the body
|
|
184
|
+
* really travels in (capped, default 60°) and the spine counter-turns, so the chest keeps its
|
|
185
|
+
* facing. Arcs and strafing stop needing a clip per angle.
|
|
186
|
+
*
|
|
187
|
+
* Both need to know the body's motion, which a `Locomotion` feeds every frame; without one, set
|
|
188
|
+
* `_creator.animatorSetMotion` yourself or leave warping off. Off by default.
|
|
189
|
+
*
|
|
190
|
+
* model.anim.warp = true // both, with the defaults
|
|
191
|
+
* model.anim.warp = { stride: [0.7, 1.4], orientation: 45 }
|
|
192
|
+
*/
|
|
193
|
+
set warp(w: WarpOptions | boolean);
|
|
194
|
+
/** A foot planted (world position) — audio, dust, decals. Fires for what the BASE layer shows,
|
|
195
|
+
* from the clip's own contacts; a clip with no contacts fires nothing. */
|
|
196
|
+
onStep(cb: StepHandler): this;
|
|
197
|
+
offStep(cb: StepHandler): this;
|
|
198
|
+
/** A new layer on top (masked override / additive). The returned object is its handle. */
|
|
199
|
+
addLayer(options?: LayerOptions): Layer;
|
|
200
|
+
on(event: string, cb: ClipEventHandler): this;
|
|
201
|
+
off(event: string, cb: ClipEventHandler): this;
|
|
202
|
+
/** Global playback rate: 0.3 = slow-mo, 0 = pause. */
|
|
203
|
+
get speed(): number;
|
|
204
|
+
set speed(v: number);
|
|
205
|
+
/** Root motion: the root bone's horizontal travel comes OFF the pose and moves the node instead —
|
|
206
|
+
* or its CharacterController (on this node or an ancestor) as a velocity, so it collides. For
|
|
207
|
+
* clips whose hips actually travel (Mixamo without "In Place", lunges, rolls). A character that
|
|
208
|
+
* moves under a `Locomotion` gets this from its displacement mode instead. */
|
|
209
|
+
get rootMotion(): boolean;
|
|
210
|
+
set rootMotion(on: boolean);
|
|
211
|
+
/** With `rootMotion`, the root bone's TURN (its yaw about the node's up, since the clip's first
|
|
212
|
+
* frame) is root motion too: it comes off the pose and turns the node the travel lands on — the
|
|
213
|
+
* character (or the model) faces where a turn-start / turn-in-place / arc clip took it, and the
|
|
214
|
+
* crossfade into the next clip keeps that heading instead of swinging back. Off by default: a
|
|
215
|
+
* walk cycle's hip sway is a turn too, and most rigs want it in the pose; turn it on for a rig
|
|
216
|
+
* whose root bone carries the heading (`lecodes assets retarget --root-rotation yaw`). */
|
|
217
|
+
get rootRotation(): boolean;
|
|
218
|
+
set rootRotation(on: boolean);
|
|
219
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ActiveClip, LoopDef, LoopOptions, PlayOptions, StopOptions } from "./core";
|
|
2
|
+
import type { Loop } from "./Loop";
|
|
3
|
+
import type { Playback } from "./Playback";
|
|
4
|
+
export declare class Layer {
|
|
5
|
+
private readonly _r;
|
|
6
|
+
private readonly _c;
|
|
7
|
+
/** Play a one-shot on this layer (transitioned over `fade`); resolves at its hand-over. */
|
|
8
|
+
play(clip?: string | number, options?: PlayOptions): Playback;
|
|
9
|
+
/** Set / transition this layer's loop (a clip, or a blend space) — over `fade` from whatever the
|
|
10
|
+
* layer shows, a one-shot included (it is cut short). */
|
|
11
|
+
playLoop(def: LoopDef, options?: LoopOptions): Loop | undefined;
|
|
12
|
+
/** Fade everything on this layer out — one-shots and its loop. */
|
|
13
|
+
stop(options?: StopOptions): this;
|
|
14
|
+
/** ANTICIPATION for the NEXT play / playLoop on this layer (consumed by it): the transition begins with
|
|
15
|
+
* every joint moving AGAINST the new clip's motion - `amount` x its velocity - and the transition's
|
|
16
|
+
* spring brings it round: a wind-up before the swing. Position and rotation, the joints the layer
|
|
17
|
+
* drives. 0.3-1 reads as a natural anticipation; the duration is the transition's own fade.
|
|
18
|
+
* Ignored by hosts without it. */
|
|
19
|
+
anticipate(amount: number): this;
|
|
20
|
+
/** This layer's current loop (the object the last `playLoop()` returned), if any. */
|
|
21
|
+
get loop(): Loop | undefined;
|
|
22
|
+
/** Where this layer is in the gait cycle, 0–1 (-1 = what it shows has no cycle). */
|
|
23
|
+
get phase(): number;
|
|
24
|
+
/** Layer contribution 0–1. */
|
|
25
|
+
get weight(): number;
|
|
26
|
+
set weight(v: number);
|
|
27
|
+
/** A one-shot on this layer hasn't handed over yet. */
|
|
28
|
+
get busy(): boolean;
|
|
29
|
+
/** What this layer shows this frame with its weight — its one-shot, or its loop's members. */
|
|
30
|
+
get active(): ActiveClip[];
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BlendPosition } from "./core";
|
|
2
|
+
export declare class Loop {
|
|
3
|
+
private readonly _r;
|
|
4
|
+
private readonly _c;
|
|
5
|
+
/** Position on the axis (number) or plane (`[x, y]`) — units are whatever the positions use. Live
|
|
6
|
+
* even while a one-shot plays (the loop returns at the new mix). */
|
|
7
|
+
get value(): BlendPosition;
|
|
8
|
+
set value(v: BlendPosition);
|
|
9
|
+
/** Where the loop is in its GAIT cycle, 0–1: 0 at a left-foot-down, 0.5 at a right-foot-down —
|
|
10
|
+
* one clock for every member, aligned by their contacts (a walk and a run whose feet land at
|
|
11
|
+
* different fractions of their clips still agree). Set it to jump the cycle: `playLoop(def,
|
|
12
|
+
* { phase })` on the way in, or here to re-sync with something else. */
|
|
13
|
+
get phase(): number;
|
|
14
|
+
set phase(v: number);
|
|
15
|
+
/** Each member's share of the mix, 0–1. */
|
|
16
|
+
get weights(): Record<string, number>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AnimationClip } from "./AnimationClip";
|
|
2
|
+
import type { StopOptions } from "./core";
|
|
3
|
+
import type { Layer } from "./Layer";
|
|
4
|
+
export declare class Playback implements PromiseLike<boolean> {
|
|
5
|
+
private readonly _r;
|
|
6
|
+
private readonly _c;
|
|
7
|
+
/** The clip that plays. */
|
|
8
|
+
get clip(): AnimationClip;
|
|
9
|
+
/** The layer it plays on. */
|
|
10
|
+
get layer(): Layer;
|
|
11
|
+
/** Clock (s). */
|
|
12
|
+
get time(): number;
|
|
13
|
+
/** 0–1 through the clip (the current cycle, when looping). */
|
|
14
|
+
get progress(): number;
|
|
15
|
+
/** Where this clip is in the GAIT cycle now, 0–1 (-1 when it has none). */
|
|
16
|
+
get phase(): number;
|
|
17
|
+
/** The root yaw the clip has turned the body by so far, radians (+ = left) — a turn clip's progress. */
|
|
18
|
+
get turned(): number;
|
|
19
|
+
/** The root yaw still to come: where this clip will leave the body facing, relative to now (rad). */
|
|
20
|
+
get turnLeft(): number;
|
|
21
|
+
/** The horizontal distance the clip's root has travelled so far, metres. */
|
|
22
|
+
get travelled(): number;
|
|
23
|
+
/** Not handed over yet (the clip still owns the layer). */
|
|
24
|
+
get playing(): boolean;
|
|
25
|
+
/** Contribution to the pose: 1 while this clip is the layer's source, 0 once something else took
|
|
26
|
+
* the layer over (the difference between the two poses is what decays, not this weight). */
|
|
27
|
+
get weight(): number;
|
|
28
|
+
/** Resolves at the hand-over (`true`) or when cut short (`false`) — the promise `await playback`
|
|
29
|
+
* uses; the one to return from async functions or put in `Promise.all`. */
|
|
30
|
+
get done(): Promise<boolean>;
|
|
31
|
+
then<A = boolean, B = never>(onFulfilled?: ((v: boolean) => A | PromiseLike<A>) | null, onRejected?: ((e: unknown) => B | PromiseLike<B>) | null): Promise<A | B>;
|
|
32
|
+
/** Move the clock (s). */
|
|
33
|
+
seek(time: number): this;
|
|
34
|
+
/** Cut this clip short (the layer's loop comes back if nothing else takes over), over `fade`. */
|
|
35
|
+
stop(options?: StopOptions): this;
|
|
36
|
+
}
|