@needle-tools/engine 5.1.0-alpha.4 → 5.1.0-alpha.6

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 (133) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-DQCuBTVp.umd.cjs → needle-engine.bundle-5avtTUMM.umd.cjs} +149 -148
  4. package/dist/{needle-engine.bundle-AjVIot3d.min.js → needle-engine.bundle-BHcw4C8f.min.js} +187 -186
  5. package/dist/{needle-engine.bundle-B7cqsI4c.js → needle-engine.bundle-C0gPOq4m.js} +7522 -7092
  6. package/dist/needle-engine.d.ts +715 -176
  7. package/dist/needle-engine.js +595 -593
  8. package/dist/needle-engine.min.js +1 -1
  9. package/dist/needle-engine.umd.cjs +1 -1
  10. package/dist/three.js +1 -0
  11. package/dist/three.min.js +21 -21
  12. package/dist/three.umd.cjs +16 -16
  13. package/lib/engine/api.d.ts +3 -1
  14. package/lib/engine/api.js +3 -1
  15. package/lib/engine/api.js.map +1 -1
  16. package/lib/engine/codegen/register_types.js +10 -10
  17. package/lib/engine/codegen/register_types.js.map +1 -1
  18. package/lib/engine/engine_camera.fit.js +16 -4
  19. package/lib/engine/engine_camera.fit.js.map +1 -1
  20. package/lib/engine/engine_context.d.ts +20 -7
  21. package/lib/engine/engine_context.js +36 -14
  22. package/lib/engine/engine_context.js.map +1 -1
  23. package/lib/engine/engine_context_eventbus.d.ts +47 -0
  24. package/lib/engine/engine_context_eventbus.js +47 -0
  25. package/lib/engine/engine_context_eventbus.js.map +1 -0
  26. package/lib/engine/engine_init.js +2 -2
  27. package/lib/engine/engine_init.js.map +1 -1
  28. package/lib/engine/engine_input.d.ts +23 -4
  29. package/lib/engine/engine_input.js +2 -1
  30. package/lib/engine/engine_input.js.map +1 -1
  31. package/lib/engine/engine_license.d.ts +7 -7
  32. package/lib/engine/engine_license.js +185 -57
  33. package/lib/engine/engine_license.js.map +1 -1
  34. package/lib/engine/engine_networking_blob.js +3 -3
  35. package/lib/engine/engine_networking_blob.js.map +1 -1
  36. package/lib/engine/engine_physics_rapier.d.ts +10 -0
  37. package/lib/engine/engine_physics_rapier.js +6 -0
  38. package/lib/engine/engine_physics_rapier.js.map +1 -1
  39. package/lib/engine/engine_types.d.ts +10 -0
  40. package/lib/engine/engine_utils_qrcode.js +2 -2
  41. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  42. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  43. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  44. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  45. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  46. package/lib/engine/webcomponents/needle-engine.js +2 -2
  47. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  48. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  49. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  50. package/lib/engine/xr/TempXRContext.js +2 -2
  51. package/lib/engine/xr/TempXRContext.js.map +1 -1
  52. package/lib/engine-components/AnimationBuilder.d.ts +158 -0
  53. package/lib/engine-components/AnimationBuilder.js +305 -0
  54. package/lib/engine-components/AnimationBuilder.js.map +1 -0
  55. package/lib/engine-components/Animator.js +6 -1
  56. package/lib/engine-components/Animator.js.map +1 -1
  57. package/lib/engine-components/AnimatorController.builder.d.ts +101 -23
  58. package/lib/engine-components/AnimatorController.builder.js +88 -20
  59. package/lib/engine-components/AnimatorController.builder.js.map +1 -1
  60. package/lib/engine-components/AnimatorController.js +2 -0
  61. package/lib/engine-components/AnimatorController.js.map +1 -1
  62. package/lib/engine-components/ContactShadows.d.ts +1 -0
  63. package/lib/engine-components/ContactShadows.js +14 -1
  64. package/lib/engine-components/ContactShadows.js.map +1 -1
  65. package/lib/engine-components/DropListener.js +3 -0
  66. package/lib/engine-components/DropListener.js.map +1 -1
  67. package/lib/engine-components/OrbitControls.d.ts +0 -2
  68. package/lib/engine-components/OrbitControls.js +14 -1
  69. package/lib/engine-components/OrbitControls.js.map +1 -1
  70. package/lib/engine-components/SceneSwitcher.js +3 -0
  71. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  72. package/lib/engine-components/api.d.ts +1 -0
  73. package/lib/engine-components/api.js +1 -0
  74. package/lib/engine-components/api.js.map +1 -1
  75. package/lib/engine-components/codegen/components.d.ts +6 -6
  76. package/lib/engine-components/codegen/components.js +6 -6
  77. package/lib/engine-components/codegen/components.js.map +1 -1
  78. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  79. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  80. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  81. package/lib/engine-components/timeline/PlayableDirector.d.ts +7 -7
  82. package/lib/engine-components/timeline/PlayableDirector.js +6 -6
  83. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  84. package/lib/engine-components/timeline/TimelineBuilder.d.ts +175 -9
  85. package/lib/engine-components/timeline/TimelineBuilder.js +108 -2
  86. package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -1
  87. package/lib/engine-components/timeline/TimelineTracks.d.ts +15 -7
  88. package/lib/engine-components/timeline/TimelineTracks.js +22 -14
  89. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  90. package/lib/engine-components/web/CursorFollow.d.ts +0 -1
  91. package/lib/engine-components/web/CursorFollow.js +0 -1
  92. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  93. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +62 -1
  94. package/lib/engine-components/webxr/WebXRImageTracking.js +55 -2
  95. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  96. package/package.json +1 -1
  97. package/plugins/common/cloud.js +6 -1
  98. package/plugins/common/license.js +26 -8
  99. package/plugins/vite/license.js +42 -7
  100. package/src/engine/api.ts +4 -1
  101. package/src/engine/codegen/register_types.ts +10 -10
  102. package/src/engine/engine_camera.fit.ts +15 -4
  103. package/src/engine/engine_context.ts +41 -16
  104. package/src/engine/engine_context_eventbus.ts +73 -0
  105. package/src/engine/engine_init.ts +2 -2
  106. package/src/engine/engine_input.ts +27 -6
  107. package/src/engine/engine_license.ts +201 -55
  108. package/src/engine/engine_networking_blob.ts +3 -3
  109. package/src/engine/engine_physics_rapier.ts +20 -6
  110. package/src/engine/engine_types.ts +22 -12
  111. package/src/engine/engine_utils_qrcode.ts +2 -2
  112. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  113. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  114. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  115. package/src/engine/webcomponents/needle-engine.ts +2 -2
  116. package/src/engine/xr/TempXRContext.ts +2 -2
  117. package/src/engine-components/AnimationBuilder.ts +472 -0
  118. package/src/engine-components/Animator.ts +6 -1
  119. package/src/engine-components/AnimatorController.builder.ts +163 -37
  120. package/src/engine-components/AnimatorController.ts +1 -0
  121. package/src/engine-components/ContactShadows.ts +15 -1
  122. package/src/engine-components/DropListener.ts +3 -0
  123. package/src/engine-components/OrbitControls.ts +16 -5
  124. package/src/engine-components/SceneSwitcher.ts +3 -0
  125. package/src/engine-components/api.ts +1 -0
  126. package/src/engine-components/codegen/components.ts +6 -6
  127. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  128. package/src/engine-components/timeline/PlayableDirector.ts +20 -20
  129. package/src/engine-components/timeline/TimelineBuilder.ts +277 -17
  130. package/src/engine-components/timeline/TimelineTracks.ts +24 -16
  131. package/src/engine-components/web/CursorFollow.ts +0 -1
  132. package/src/engine-components/webxr/WebXRImageTracking.ts +77 -7
  133. package/src/vite-env.d.ts +0 -16
@@ -46,6 +46,7 @@ import { Intersection } from 'three';
46
46
  import { IParticleSystem as IParticleSystem_2 } from 'three.quarks';
47
47
  import { KeyframeTrack } from 'three';
48
48
  import { Layers } from 'three';
49
+ import { Light as Light_2 } from 'three';
49
50
  import { LightProbe } from 'three';
50
51
  import { Line2 } from '../../../../node_modules/@types/three/examples/jsm/lines/Line2.js';
51
52
  import { Loader } from 'three';
@@ -123,6 +124,8 @@ export declare class __Ignore {
123
124
 
124
125
  export declare function __internalNotifyObjectDestroyed(obj: Object3D): void;
125
126
 
127
+ /* Excluded from this release type: __otwqOR */
128
+
126
129
  /** Data describing the accessible semantics for a 3D object or component. */
127
130
  declare type AccessibilityData = {
128
131
  /** ARIA role (e.g. `"button"`, `"img"`, `"region"`). */
@@ -269,8 +272,15 @@ export declare type ActivationClipOptions = {
269
272
  easeOut?: number;
270
273
  };
271
274
 
272
- export declare class ActivationTrackHandler extends TrackHandler {
273
- evaluate(time: number): void;
275
+ /**
276
+ * Builder for activation tracks. Provides `.clip()` for defining activation windows.
277
+ * @category Animation and Sequencing
278
+ */
279
+ export declare interface ActivationTrackBuilder extends TimelineBuilderBase {
280
+ /** Adds an activation clip that shows/hides the bound object */
281
+ clip(options: ActivationClipOptions): ActivationTrackBuilder;
282
+ /** Mutes this track so it is skipped during playback */
283
+ muted(muted?: boolean): ActivationTrackBuilder;
274
284
  }
275
285
 
276
286
  export declare const activeInHierarchyFieldName = "needle_isActiveInHierarchy";
@@ -506,6 +516,62 @@ declare class Animation_2 extends Component implements IAnimationComponent {
506
516
  }
507
517
  export { Animation_2 as Animation }
508
518
 
519
+ /**
520
+ * A fluent builder for creating `AnimationClip` instances from code.
521
+ *
522
+ * Use {@link AnimationBuilder.create} to start a new builder, chain `.track()` calls
523
+ * to add animation tracks, and call `.build()` to produce the clip.
524
+ *
525
+ * @example Single track
526
+ * ```ts
527
+ * const clip = AnimationBuilder.create()
528
+ * .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
529
+ * .build();
530
+ * ```
531
+ *
532
+ * @example Multiple tracks
533
+ * ```ts
534
+ * const clip = AnimationBuilder.create("DoorOpen")
535
+ * .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
536
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
537
+ * .build(room);
538
+ * ```
539
+ *
540
+ * @category Animation and Sequencing
541
+ * @group Utilities
542
+ */
543
+ export declare class AnimationBuilder {
544
+ private _name?;
545
+ private _tracks;
546
+ /** Creates a new AnimationBuilder instance */
547
+ static create(name?: string): AnimationBuilder;
548
+ constructor(name?: string);
549
+ /** Adds an animation track for an Object3D's position or scale */
550
+ track(target: Object3D, property: "position" | "scale", keyframes: KF_2<Vec3Value>, options?: TrackOptions): this;
551
+ /** Adds an animation track for an Object3D's quaternion */
552
+ track(target: Object3D, property: "quaternion", keyframes: KF_2<QuatValue>, options?: TrackOptions): this;
553
+ /** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
554
+ track(target: Object3D, property: "rotation", keyframes: KF_2<EulerValue>, options?: TrackOptions): this;
555
+ /** Adds an animation track for an Object3D's visibility */
556
+ track(target: Object3D, property: "visible", keyframes: KF_2<boolean>, options?: TrackOptions): this;
557
+ /** Adds an animation track for a material's numeric property */
558
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_2<number>, options?: TrackOptions): this;
559
+ /** Adds an animation track for a material's color property */
560
+ track(target: Material, property: "color" | "emissive", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
561
+ /** Adds an animation track for a light's numeric property */
562
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_2<number>, options?: TrackOptions): this;
563
+ /** Adds an animation track for a light's color */
564
+ track(target: Light_2, property: "color", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
565
+ /** Adds an animation track for a camera's numeric property */
566
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_2<number>, options?: TrackOptions): this;
567
+ /**
568
+ * Builds and returns the `AnimationClip`.
569
+ * @param root - Optional root Object3D for resolving track paths.
570
+ * When provided, tracks targeting a different object use `target.name` for named resolution.
571
+ */
572
+ build(root?: Object3D): AnimationClip;
573
+ }
574
+
509
575
  /**
510
576
  * @category Animation and Sequencing
511
577
  * @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
@@ -624,6 +690,19 @@ export declare class AnimationExtension implements IUSDExporterExtension {
624
690
 
625
691
  declare type AnimationIdentifier = AnimationClip | number | string | undefined;
626
692
 
693
+ /** User-friendly interpolation mode names */
694
+ export declare type AnimationInterpolation = "linear" | "smooth" | "step";
695
+
696
+ /** A single keyframe: a time and a value */
697
+ export declare type AnimationKeyframe<V> = {
698
+ /** Time in seconds */
699
+ time: number;
700
+ /** The value at this time */
701
+ value: V;
702
+ /** Interpolation mode for this track (default: `"linear"`). Note: Three.js applies one mode per track; the first keyframe's mode is used. */
703
+ interpolation?: AnimationInterpolation;
704
+ };
705
+
627
706
  /**
628
707
  * Registry for animation related data. Use {@link registerAnimationMixer} to register an animation mixer instance.
629
708
  * Can be accessed from {@link Context.animations} and is used internally e.g. when exporting GLTF files.
@@ -644,43 +723,39 @@ declare class AnimationsRegistry {
644
723
  unregisterAnimationMixer(mixer: AnimationMixer | null | undefined): void;
645
724
  }
646
725
 
647
- export declare class AnimationTrackHandler extends TrackHandler {
648
- /* Excluded from this release type: models */
649
- /* Excluded from this release type: trackOffset */
650
- /** The object that is being animated. */
651
- target?: Object3D;
652
- /** The AnimationMixer, should be shared with the animator if an animator is bound */
653
- mixer?: AnimationMixer;
654
- clips: Array<AnimationClip>;
655
- actions: Array<AnimationAction>;
656
- /**
657
- * You can use the weight to blend the timeline animation tracks with multiple animation tracks on the same object.
658
- * @default 1
659
- */
660
- weight: number;
661
- /** holds data/info about clips differences */
662
- private _actionOffsets;
663
- private _didBind;
664
- private _animator;
665
- onDisable(): void;
666
- onDestroy(): void;
667
- onStateChanged(): void;
668
- createHooks(clipModel: Models.AnimationClipModel, clip: any): void;
669
- bind(): void;
670
- private ensureTrackOffsets;
671
- private _useclipOffsets;
672
- private _totalOffsetPosition;
673
- private _totalOffsetRotation;
674
- private _totalOffsetPosition2;
675
- private _totalOffsetRotation2;
676
- private _summedPos;
677
- private _tempPos;
678
- private _summedRot;
679
- private _tempRot;
680
- private _clipRotQuat;
681
- evaluate(time: number): void;
682
- private createRotationInterpolant;
683
- private createPositionInterpolant;
726
+ /**
727
+ * Builder for animation tracks.
728
+ * Provides `.clip()` for pre-built AnimationClips and `.track()` for inline animation definition.
729
+ *
730
+ * @category Animation and Sequencing
731
+ */
732
+ export declare interface AnimationTrackBuilder extends TimelineBuilderBase {
733
+ /** Adds a pre-built AnimationClip */
734
+ clip(asset: AnimationClip, options?: AnimationClipOptions): AnimationTrackBuilder;
735
+ /** Adds a clip from a single {@link TrackDescriptor} */
736
+ clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): AnimationTrackBuilder;
737
+ /** Adds a clip from multiple {@link TrackDescriptor}s */
738
+ clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): AnimationTrackBuilder;
739
+ /** Adds an animation track for an Object3D's position or scale */
740
+ track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): AnimationTrackBuilder;
741
+ /** Adds an animation track for an Object3D's quaternion */
742
+ track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): AnimationTrackBuilder;
743
+ /** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
744
+ track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): AnimationTrackBuilder;
745
+ /** Adds an animation track for an Object3D's visibility */
746
+ track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): AnimationTrackBuilder;
747
+ /** Adds an animation track for a material's numeric property */
748
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
749
+ /** Adds an animation track for a material's color property */
750
+ track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
751
+ /** Adds an animation track for a light's numeric property */
752
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
753
+ /** Adds an animation track for a light's color */
754
+ track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
755
+ /** Adds an animation track for a camera's numeric property */
756
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
757
+ /** Mutes this track so it is skipped during playback */
758
+ muted(muted?: boolean): AnimationTrackBuilder;
684
759
  }
685
760
 
686
761
  declare class AnimationTriggers {
@@ -1197,11 +1272,15 @@ export declare class AnimatorController {
1197
1272
  /**
1198
1273
  * A fluent builder for creating {@link AnimatorController} instances from code.
1199
1274
  *
1200
- * Use {@link AnimatorController.build} to create a new builder.
1275
+ * Use {@link AnimatorControllerBuilder.create} or {@link AnimatorController.build} to create a new builder.
1201
1276
  *
1202
- * @example
1277
+ * The builder tracks state names and parameter types through the fluent chain,
1278
+ * providing autocomplete for state names in `.transition()` and type-aware
1279
+ * `.condition()` calls (e.g., trigger parameters don't require a mode argument).
1280
+ *
1281
+ * @example With pre-built AnimationClips
1203
1282
  * ```ts
1204
- * const controller = AnimatorController.build("CharacterController")
1283
+ * const controller = AnimatorControllerBuilder.create("CharacterController")
1205
1284
  * .floatParameter("Speed", 0)
1206
1285
  * .triggerParameter("Jump")
1207
1286
  * .state("Idle", { clip: idleClip, loop: true })
@@ -1212,36 +1291,70 @@ export declare class AnimatorController {
1212
1291
  * .transition("Walk", "Idle", { duration: 0.25 })
1213
1292
  * .condition("Speed", "less", 0.1)
1214
1293
  * .transition("*", "Jump", { duration: 0.1 })
1215
- * .condition("Jump", "if")
1294
+ * .condition("Jump")
1216
1295
  * .transition("Jump", "Idle", { hasExitTime: true, exitTime: 0.9, duration: 0.25 })
1217
1296
  * .build();
1218
1297
  * ```
1219
1298
  *
1299
+ * @example With inline tracks (no pre-built clips needed)
1300
+ * ```ts
1301
+ * const controller = AnimatorControllerBuilder.create("Door")
1302
+ * .boolParameter("Open", false)
1303
+ * .state("Closed", { loop: true })
1304
+ * .track(door, "position", { from: [0, 0, 0], to: [0, 0, 0], duration: 1 })
1305
+ * .state("Open", { loop: true })
1306
+ * .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
1307
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
1308
+ * .transition("Closed", "Open", { duration: 0.25 })
1309
+ * .condition("Open", "if")
1310
+ * .transition("Open", "Closed", { duration: 0.25 })
1311
+ * .condition("Open", "ifNot")
1312
+ * .build(room);
1313
+ * ```
1314
+ *
1315
+ * @typeParam TStates - Union of state names added via `.state()`. Used for autocomplete and validation in `.transition()` and `.defaultState()`.
1316
+ * @typeParam TParams - Record mapping parameter names to their types (`"trigger"`, `"bool"`, `"float"`, `"int"`). Used for type-aware `.condition()` overloads.
1317
+ *
1220
1318
  * @category Animation and Sequencing
1221
1319
  * @group Utilities
1222
1320
  */
1223
- export declare class AnimatorControllerBuilder {
1321
+ export declare class AnimatorControllerBuilder<TStates extends string = never, TParams extends Record<string, "trigger" | "bool" | "float" | "int"> = {}> {
1224
1322
  private _name;
1225
1323
  private _parameters;
1226
1324
  private _states;
1227
1325
  private _anyStateTransitions;
1228
1326
  private _defaultStateName;
1229
1327
  private _lastTransition;
1328
+ private _lastState;
1329
+ /**
1330
+ * Creates a new AnimatorControllerBuilder instance.
1331
+ * @param name - Optional name for the controller
1332
+ */
1333
+ static create(name?: string): AnimatorControllerBuilder;
1230
1334
  constructor(name?: string);
1231
1335
  /** Adds a float parameter */
1232
- floatParameter(name: string, defaultValue?: number): this;
1336
+ floatParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "float">>;
1233
1337
  /** Adds an integer parameter */
1234
- intParameter(name: string, defaultValue?: number): this;
1338
+ intParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "int">>;
1235
1339
  /** Adds a boolean parameter */
1236
- boolParameter(name: string, defaultValue?: boolean): this;
1340
+ boolParameter<N extends string>(name: N, defaultValue?: boolean): AnimatorControllerBuilder<TStates, TParams & Record<N, "bool">>;
1237
1341
  /** Adds a trigger parameter */
1238
- triggerParameter(name: string): this;
1342
+ triggerParameter<N extends string>(name: N): AnimatorControllerBuilder<TStates, TParams & Record<N, "trigger">>;
1239
1343
  /**
1240
1344
  * Adds a state to the controller. The first state added becomes the default state.
1345
+ *
1346
+ * When `options.clip` is provided, the state uses that clip directly.
1347
+ * When omitted, chain `.track()` calls to define animation tracks inline:
1348
+ * ```ts
1349
+ * .state("Open", { loop: true })
1350
+ * .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
1351
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
1352
+ * ```
1353
+ *
1241
1354
  * @param name - Unique name for the state
1242
- * @param options - State configuration including clip, loop, speed
1355
+ * @param options - State configuration including clip, loop, speed. When omitted, use `.track()` to add animation data.
1243
1356
  */
1244
- state(name: string, options: StateOptions): this;
1357
+ state<N extends string>(name: N, options?: StateOptions): AnimatorControllerBuilder<TStates | N, TParams>;
1245
1358
  /**
1246
1359
  * Adds a transition between two states.
1247
1360
  * Use `"*"` as the source to create a transition from any state.
@@ -1250,26 +1363,52 @@ export declare class AnimatorControllerBuilder {
1250
1363
  * @param to - Destination state name
1251
1364
  * @param options - Transition configuration
1252
1365
  */
1253
- transition(from: string, to: string, options?: TransitionOptions): this;
1366
+ transition(from: TStates | "*", to: TStates, options?: TransitionOptions): AnimatorControllerBuilder<TStates, TParams>;
1254
1367
  /**
1255
1368
  * Adds a condition to the most recently added transition.
1256
1369
  * Multiple conditions on the same transition are AND-ed together.
1370
+ *
1371
+ * The required arguments depend on the parameter type:
1372
+ * - **Trigger**: `.condition("Jump")` — mode defaults to `"if"`, no threshold needed
1373
+ * - **Bool**: `.condition("Open", "if")` or `.condition("Open", "ifNot")`
1374
+ * - **Float/Int**: `.condition("Speed", "greater", 0.1)`
1375
+ *
1257
1376
  * @param parameter - Name of the parameter to evaluate
1258
- * @param mode - Condition mode: `"if"`, `"ifNot"`, `"greater"`, `"less"`, `"equals"`, `"notEqual"`
1259
- * @param threshold - Comparison threshold for numeric conditions (default: 0)
1260
1377
  */
1261
- condition(parameter: string, mode: ConditionMode, threshold?: number): this;
1378
+ condition(parameter: ParamNamesOfType<TParams, "trigger">, mode?: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
1379
+ condition(parameter: ParamNamesOfType<TParams, "bool">, mode: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
1380
+ condition(parameter: ParamNamesOfType<TParams, "float" | "int">, mode: "greater" | "less" | "equals" | "notEqual", threshold?: number): AnimatorControllerBuilder<TStates, TParams>;
1381
+ /** Adds an animation track for an Object3D's position or scale to the current state */
1382
+ track(target: Object3D, property: "position" | "scale", keyframes: KF<Vec3Value>, options?: TrackOptions): this;
1383
+ /** Adds an animation track for an Object3D's quaternion to the current state */
1384
+ track(target: Object3D, property: "quaternion", keyframes: KF<QuatValue>, options?: TrackOptions): this;
1385
+ /** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) to the current state */
1386
+ track(target: Object3D, property: "rotation", keyframes: KF<EulerValue>, options?: TrackOptions): this;
1387
+ /** Adds an animation track for an Object3D's visibility to the current state */
1388
+ track(target: Object3D, property: "visible", keyframes: KF<boolean>, options?: TrackOptions): this;
1389
+ /** Adds an animation track for a material's numeric property to the current state */
1390
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF<number>, options?: TrackOptions): this;
1391
+ /** Adds an animation track for a material's color property to the current state */
1392
+ track(target: Material, property: "color" | "emissive", keyframes: KF<ColorValue>, options?: TrackOptions): this;
1393
+ /** Adds an animation track for a light's numeric property to the current state */
1394
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF<number>, options?: TrackOptions): this;
1395
+ /** Adds an animation track for a light's color to the current state */
1396
+ track(target: Light_2, property: "color", keyframes: KF<ColorValue>, options?: TrackOptions): this;
1397
+ /** Adds an animation track for a camera's numeric property to the current state */
1398
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF<number>, options?: TrackOptions): this;
1262
1399
  /**
1263
1400
  * Sets which state is the default/entry state.
1264
1401
  * If not called, the first added state is used.
1265
1402
  * @param name - Name of the state
1266
1403
  */
1267
- defaultState(name: string): this;
1404
+ defaultState(name: TStates): AnimatorControllerBuilder<TStates, TParams>;
1268
1405
  /**
1269
1406
  * Builds and returns the {@link AnimatorController}.
1270
1407
  * Resolves all state name references to indices.
1408
+ * @param root - Optional root Object3D for resolving {@link TrackDescriptor} track paths.
1409
+ * When provided, tracks targeting a different object use `target.name` for named resolution.
1271
1410
  */
1272
- build(): AnimatorController;
1411
+ build(root?: Object3D): AnimatorController;
1273
1412
  }
1274
1413
 
1275
1414
  export declare type AnimatorControllerModel = {
@@ -1907,46 +2046,14 @@ export declare class AudioSource extends Component {
1907
2046
  }
1908
2047
 
1909
2048
  /**
1910
- * Handles audio playback for a timeline audio track.
1911
- *
1912
- * **Runtime mutation:** The track model is read fresh every frame during `evaluate()`.
1913
- * You can mutate `track.volume`, `clip.start`, `clip.end`, `clip.asset.volume` etc.
1914
- * at any time — changes take effect on the next frame without rebuilding the timeline.
1915
- *
1916
- * **Audio stopping:** Audio clips are automatically stopped when:
1917
- * - Timeline time moves outside a clip's `[start, end]` range (e.g. jumping or normal playback advancing past a clip)
1918
- * - The track is muted (via `muted = true`)
1919
- * - The director is stopped (`director.stop()`)
1920
- * - The director is paused (`director.pause()`)
1921
- * - The director is disabled or destroyed
2049
+ * Builder for audio tracks. Provides `.clip()` for adding audio clips by URL.
2050
+ * @category Animation and Sequencing
1922
2051
  */
1923
- export declare class AudioTrackHandler extends TrackHandler {
1924
- models: Array<AudioClipModel_2>;
1925
- listener: AudioListener_3;
1926
- audio: Array<Audio_2>;
1927
- audioContextTimeOffset: Array<number>;
1928
- lastTime: number;
1929
- audioSource?: AudioSource;
1930
- /** Track-level volume multiplier (0–1). Applied on top of per-clip volume each frame. */
1931
- get volume(): number;
1932
- set volume(val: number);
1933
- private _audioLoader;
1934
- private getAudioFilePath;
1935
- onAllowAudioChanged(allow: boolean): void;
1936
- addModel(model: Models.ClipModel): void;
1937
- onDisable(): void;
1938
- onDestroy(): void;
1939
- onMuteChanged(): void;
1940
- stop(): void;
1941
- private _playableDirectorResumed;
1942
- onPauseChanged(): void;
1943
- evaluate(time: number): void;
1944
- /** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
1945
- loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
1946
- private isInTimeRange;
1947
- private static _audioBuffers;
1948
- static dispose(): void;
1949
- private handleAudioLoading;
2052
+ export declare interface AudioTrackBuilder extends TimelineBuilderBase {
2053
+ /** Adds an audio clip by URL */
2054
+ clip(url: string, options: AudioClipOptions): AudioTrackBuilder;
2055
+ /** Mutes this track so it is skipped during playback */
2056
+ muted(muted?: boolean): AudioTrackBuilder;
1950
2057
  }
1951
2058
 
1952
2059
  /* Excluded from this release type: AuralMode */
@@ -3717,6 +3824,9 @@ declare class ColorSerializer extends TypeSerializer {
3717
3824
 
3718
3825
  export declare let colorSerializer: ColorSerializer;
3719
3826
 
3827
+ /** A Color value, either as a Three.js Color or as an `[r, g, b]` tuple (0–1) */
3828
+ declare type ColorValue = Color | [number, number, number];
3829
+
3720
3830
  /**
3721
3831
  * Utility method to check if two materials were created from the same glTF material
3722
3832
  */
@@ -4385,6 +4495,7 @@ export declare class ContactShadows extends Component {
4385
4495
  set needsUpdate(val: boolean);
4386
4496
  get needsUpdate(): boolean;
4387
4497
  private _needsUpdate;
4498
+ private _needsFit;
4388
4499
  /** All shadow objects are parented to this object.
4389
4500
  * The gameObject itself should not be transformed because we want the ContactShadows object e.g. also have a GroundProjectedEnv component
4390
4501
  * in which case ContactShadows scale would affect the projection
@@ -4638,19 +4749,31 @@ export declare class Context implements IContext {
4638
4749
  private _mainCamera;
4639
4750
  private _fallbackCamera;
4640
4751
  /** access application state (e.g. if all audio should be muted) */
4641
- application: Application;
4752
+ get application(): Application;
4753
+ private _application;
4642
4754
  /** access animation mixer used by components in the scene */
4643
- animations: AnimationsRegistry;
4755
+ get animations(): AnimationsRegistry;
4756
+ private _animations;
4644
4757
  /** access timings (current frame number, deltaTime, timeScale, ...) */
4645
- time: Time;
4758
+ get time(): Time;
4759
+ private _time;
4646
4760
  /** access input data (e.g. click or touch events) */
4647
- input: Input;
4761
+ get input(): Input;
4762
+ private _input;
4648
4763
  /** access physics related methods (e.g. raycasting). To access the phyiscs engine use `context.physics.engine` */
4649
- physics: Physics;
4764
+ get physics(): Physics;
4765
+ private _physics;
4650
4766
  /** access postprocessing effects stack. Add/remove effects and configure adaptive performance settings */
4651
- postprocessing: PostProcessing;
4767
+ get postprocessing(): PostProcessing;
4768
+ private _postprocessing;
4652
4769
  /** access networking methods (use it to send or listen to messages or join a networking backend) */
4653
- connection: NetworkConnection;
4770
+ get connection(): NetworkConnection;
4771
+ private _connection;
4772
+ /** context-level event bus for decoupled component communication
4773
+ * @see {@link ContextEventMap} for known event types
4774
+ */
4775
+ get events(): EventBus;
4776
+ private _events;
4654
4777
  /** @deprecated AssetDatabase is deprecated */
4655
4778
  assets: AssetDatabase;
4656
4779
  /** All registered lights in the scene, maintained by the Light component.
@@ -4909,6 +5032,18 @@ export declare type ContextEventArgs = {
4909
5032
  files?: LoadedModel[];
4910
5033
  };
4911
5034
 
5035
+ /** Typed event map for {@link Context.events}.
5036
+ * Known events get full autocomplete; custom events can be typed at the call site via generic parameter.
5037
+ */
5038
+ export declare interface ContextEventMap {
5039
+ "scene-content-changed": {
5040
+ /** The component that triggered the change (e.g. SceneSwitcher, DropListener) */
5041
+ readonly source: IComponent;
5042
+ /** The root object that was added/loaded */
5043
+ readonly object: Object3D;
5044
+ };
5045
+ }
5046
+
4912
5047
  /** Use to register to various Needle Engine context events and to get access to all current instances
4913
5048
  * e.g. when being created in the DOM
4914
5049
  * @example
@@ -4984,12 +5119,15 @@ declare type ControllerAxes = "xr-standard-thumbstick" | "xr-standard-touchpad";
4984
5119
  */
4985
5120
  export declare type ControllerChangedEvt = (args: NeedleXRControllerEventArgs) => void;
4986
5121
 
4987
- export declare class ControlTrackHandler extends TrackHandler {
4988
- models: Array<Models.ClipModel>;
4989
- timelines: Array<PlayableDirector | null>;
4990
- resolveSourceObjects(_context: Context): void;
4991
- private _previousActiveModel;
4992
- evaluate(time: number): void;
5122
+ /**
5123
+ * Builder for control tracks. Provides `.clip()` for controlling nested objects/timelines.
5124
+ * @category Animation and Sequencing
5125
+ */
5126
+ export declare interface ControlTrackBuilder extends TimelineBuilderBase {
5127
+ /** Adds a control clip for a source object */
5128
+ clip(sourceObject: Object3D, options: ControlClipOptions): ControlTrackBuilder;
5129
+ /** Mutes this track so it is skipped during playback */
5130
+ muted(muted?: boolean): ControlTrackBuilder;
4993
5131
  }
4994
5132
 
4995
5133
  /**@obsolete use Graphics.copyTexture */
@@ -5177,7 +5315,6 @@ export declare class CursorFollow extends Component {
5177
5315
  * - Cursor that follows terrain or mesh surfaces
5178
5316
  *
5179
5317
  * **Important notes:**
5180
- * - Requires objects in the scene to have colliders for raycasting to work
5181
5318
  * - Works best with {@link keepDistance} set to `false` to allow depth changes
5182
5319
  * - Can be combined with {@link damping} for smooth surface following
5183
5320
  * - The raycast uses the physics system's raycast functionality
@@ -5285,6 +5422,8 @@ export declare class CustomShader extends RawShaderMaterial {
5285
5422
  onUpdateUniforms(camera?: Camera_2, obj?: any): void;
5286
5423
  }
5287
5424
 
5425
+ /* Excluded from this release type: _cxKhKwDL */
5426
+
5288
5427
  export declare const debugNet: boolean;
5289
5428
 
5290
5429
  export declare const debugOwner: boolean;
@@ -6189,6 +6328,45 @@ export declare class EnvironmentScene extends Scene {
6189
6328
  createAreaLightMaterial(intensity: number): MeshBasicMaterial;
6190
6329
  }
6191
6330
 
6331
+ /** An Euler value, either as a Three.js Euler or as a `[x, y, z]` tuple (radians) */
6332
+ declare type EulerValue = Euler | [number, number, number];
6333
+
6334
+ /** Typed event bus. Known {@link ContextEventMap} events get full autocomplete.
6335
+ * Custom events can be typed at the call site via generic parameter.
6336
+ * @example Known events
6337
+ * ```ts
6338
+ * context.events.on("scene-content-changed", e => e.object);
6339
+ * ```
6340
+ * @example Custom events — type at call site
6341
+ * ```ts
6342
+ * context.events.emit<{ pts: number }>("scored", { pts: 10 });
6343
+ * context.events.on<{ pts: number }>("scored", e => e.pts);
6344
+ * ```
6345
+ * @example Once
6346
+ * ```ts
6347
+ * context.events.on("scene-content-changed", e => { ... }, { once: true });
6348
+ * ```
6349
+ */
6350
+ export declare class EventBus {
6351
+ private _listeners;
6352
+ /** Emit a known {@link ContextEventMap} event */
6353
+ emit<K extends keyof ContextEventMap & string>(type: K, detail?: ContextEventMap[K]): void;
6354
+ /** Emit a custom event with user-provided type */
6355
+ emit<T>(type: string, detail?: T): void;
6356
+ /** Subscribe to a known {@link ContextEventMap} event. Returns an unsubscribe function. */
6357
+ on<K extends keyof ContextEventMap & string>(type: K, callback: (args: ContextEventMap[K]) => void, options?: EventBusListenerOptions): () => void;
6358
+ /** Subscribe to a custom event with user-provided type. Returns an unsubscribe function. */
6359
+ on<T>(type: string, callback: (args: T) => void, options?: EventBusListenerOptions): () => void;
6360
+ /** Remove all listeners. Called when the context is cleared or destroyed. */
6361
+ clear(): void;
6362
+ }
6363
+
6364
+ /** Options for {@link EventBus.on}. */
6365
+ export declare interface EventBusListenerOptions {
6366
+ /** If true the listener is automatically removed after the first invocation. */
6367
+ once?: boolean;
6368
+ }
6369
+
6192
6370
  /**
6193
6371
  * EventList manages a list of callbacks that can be invoked together.
6194
6372
  * Used for Unity-style events that can be configured in the editor (Unity or Blender).
@@ -7973,14 +8151,8 @@ export declare type GuidsMap = {
7973
8151
  [key: string]: string;
7974
8152
  };
7975
8153
 
7976
- /* Excluded from this release type: hasCommercialLicense */
7977
-
7978
- /* Excluded from this release type: hasIndieLicense */
7979
-
7980
8154
  /* Excluded from this release type: hasPointerEventComponent */
7981
8155
 
7982
- /* Excluded from this release type: hasProLicense */
7983
-
7984
8156
  export declare function hideDebugConsole(): void;
7985
8157
 
7986
8158
  export declare enum HideFlags {
@@ -8859,14 +9031,33 @@ export declare class Input implements IInput {
8859
9031
  */
8860
9032
  private readonly _eventListeners;
8861
9033
  /** Adds an event listener for the specified event type. The callback will be called when the event is triggered.
9034
+ *
9035
+ * Returns an unsubscribe function — call it to remove the listener.
9036
+ * Pass it to {@link Behaviour.autoCleanup} for automatic lifecycle management.
9037
+ *
8862
9038
  * @param type The event type to listen for
8863
9039
  * @param callback The callback to call when the event is triggered
8864
9040
  * @param options The options for adding the event listener.
8865
- * @example Basic usage
9041
+ * @returns A function that removes the event listener when called.
9042
+ *
9043
+ * @example With autoCleanup (recommended)
8866
9044
  * ```ts
8867
- * input.addEventListener("pointerdown", (evt) => {
9045
+ * export class MyComponent extends Behaviour {
9046
+ * onEnable() {
9047
+ * this.autoCleanup(this.context.input.addEventListener("pointerdown", (evt) => {
9048
+ * console.log("Pointer down", evt.pointerId, evt.pointerType);
9049
+ * }));
9050
+ * }
9051
+ * // Listener is automatically removed on disable — no manual cleanup needed!
9052
+ * }
9053
+ * ```
9054
+ * @example Manual unsubscribe
9055
+ * ```ts
9056
+ * const off = input.addEventListener("pointerdown", (evt) => {
8868
9057
  * console.log("Pointer down", evt.pointerId, evt.pointerType);
8869
9058
  * });
9059
+ * // later
9060
+ * off();
8870
9061
  * ```
8871
9062
  * @example Adding a listener that is called after all other listeners
8872
9063
  * By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
@@ -8882,8 +9073,8 @@ export declare class Input implements IInput {
8882
9073
  * }, { once: true });
8883
9074
  * ```
8884
9075
  */
8885
- addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2): any;
8886
- addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2): any;
9076
+ addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2): () => void;
9077
+ addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2): () => void;
8887
9078
  /** Removes the event listener from the specified event type. If no queue is specified the listener will be removed from all queues.
8888
9079
  * @param type The event type to remove the listener from
8889
9080
  * @param callback The callback to remove
@@ -9491,6 +9682,11 @@ export declare interface IPhysicsEngine {
9491
9682
  * @returns False to ignore this collider, true to include it
9492
9683
  */
9493
9684
  filterPredicate?: (collider: ICollider) => boolean;
9685
+ /** When true, trigger/sensor colliders will be included in the raycast results.
9686
+ * By default trigger colliders are skipped.
9687
+ * @default false
9688
+ */
9689
+ includeTriggers?: boolean;
9494
9690
  }): RaycastResult;
9495
9691
  /**
9496
9692
  * Performs a raycast that also returns the normal vector at the hit point
@@ -9518,6 +9714,11 @@ export declare interface IPhysicsEngine {
9518
9714
  * @returns False to ignore this collider, true to include it
9519
9715
  */
9520
9716
  filterPredicate?: (collider: ICollider) => boolean;
9717
+ /** When true, trigger/sensor colliders will be included in the raycast results.
9718
+ * By default trigger colliders are skipped.
9719
+ * @default false
9720
+ */
9721
+ includeTriggers?: boolean;
9521
9722
  }): RaycastResult;
9522
9723
  /**
9523
9724
  * Finds all colliders within a sphere
@@ -10151,6 +10352,15 @@ declare class Keyframe_2 {
10151
10352
  }
10152
10353
  export { Keyframe_2 as Keyframe }
10153
10354
 
10355
+ /** Keyframe array or tween shorthand */
10356
+ declare type KF<V> = AnimationKeyframe<V>[] | Tween<V>;
10357
+
10358
+ /** Keyframe array or tween shorthand */
10359
+ declare type KF_2<V> = AnimationKeyframe<V>[] | Tween<V>;
10360
+
10361
+ /** Keyframe array or tween shorthand */
10362
+ declare type KF_3<V> = AnimationKeyframe<V>[] | Tween<V>;
10363
+
10154
10364
  declare type LabelHandle = {
10155
10365
  setText(str: string): any;
10156
10366
  };
@@ -10749,6 +10959,8 @@ declare class LowPassFilter {
10749
10959
  reset(value: number): void;
10750
10960
  }
10751
10961
 
10962
+ /* Excluded from this release type: LynjGsV */
10963
+
10752
10964
  declare type MagicSkyboxName = "studio" | "blurred-skybox" | "quicklook-ar" | "quicklook";
10753
10965
 
10754
10966
  export declare class MainModule {
@@ -10819,13 +11031,15 @@ export declare function markAsInstancedRendered(go: Object3D, instanced: boolean
10819
11031
  time: number;
10820
11032
  }
10821
11033
 
10822
- export declare class MarkerTrackHandler extends TrackHandler {
10823
- models: Array<Models.MarkerModel & Record<string, any>>;
10824
- needsSorting: boolean;
10825
- foreachMarker<T>(type?: string | null): Generator<T, void, unknown>;
10826
- onEnable(): void;
10827
- evaluate(_time: number): void;
10828
- private sort;
11034
+ /**
11035
+ * Builder for marker tracks. Provides `.marker()` for adding markers.
11036
+ * @category Animation and Sequencing
11037
+ */
11038
+ export declare interface MarkerTrackBuilder extends TimelineBuilderBase {
11039
+ /** Adds a marker referencing a signal asset by guid */
11040
+ marker(time: number, asset: string, options?: SignalMarkerOptions): MarkerTrackBuilder;
11041
+ /** Mutes this track so it is skipped during playback */
11042
+ muted(muted?: boolean): MarkerTrackBuilder;
10829
11043
  }
10830
11044
 
10831
11045
  export declare enum MarkerType {
@@ -14262,8 +14476,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
14262
14476
  * @param options The options for fitting the camera. Use to provide objects to fit to, fit direction and size and other settings.
14263
14477
  */
14264
14478
  fitCamera(options?: OrbitFitCameraOptions): any;
14265
- /** @deprecated Use fitCamera(options) */
14266
- fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">): any;
14267
14479
  private _haveAttachedKeyboardEvents;
14268
14480
  }
14269
14481
 
@@ -14464,6 +14676,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
14464
14676
  value: number | boolean | string;
14465
14677
  };
14466
14678
 
14679
+ /** Extracts parameter names of a given type from the builder's tracked parameter map */
14680
+ declare type ParamNamesOfType<TParams, PType extends string> = {
14681
+ [K in keyof TParams & string]: TParams[K] extends PType ? K : never;
14682
+ }[keyof TParams & string];
14683
+
14467
14684
  declare type ParseNumber<T> = T extends `${infer U extends number}` ? U : never;
14468
14685
 
14469
14686
  /** Load a gltf file from a url. This is the core method used by Needle Engine to load gltf files. All known extensions are registered here.
@@ -15181,15 +15398,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
15181
15398
  /** Iterates over all tracks of the timeline
15182
15399
  * @returns all tracks of the timeline
15183
15400
  */
15184
- forEachTrack(): Generator<Tracks.TrackHandler, void, unknown>;
15401
+ forEachTrack(): Generator<Tracks.TimelineTrackHandler, void, unknown>;
15185
15402
  /**
15186
15403
  * @returns all animation tracks of the timeline
15187
15404
  */
15188
- get animationTracks(): Tracks.AnimationTrackHandler[];
15405
+ get animationTracks(): Tracks.TimelineAnimationTrack[];
15189
15406
  /**
15190
15407
  * @returns all audio tracks of the timeline
15191
15408
  */
15192
- get audioTracks(): Tracks.AudioTrackHandler[];
15409
+ get audioTracks(): Tracks.TimelineAudioTrack[];
15193
15410
  /**
15194
15411
  * @returns all signal tracks of the timeline
15195
15412
  */
@@ -15197,15 +15414,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
15197
15414
  /**
15198
15415
  * @returns all marker tracks of the timeline
15199
15416
  */
15200
- get markerTracks(): Tracks.MarkerTrackHandler[];
15417
+ get markerTracks(): Tracks.TimelineMarkerTrack[];
15201
15418
  /**
15202
15419
  * @returns all activation tracks of the timeline
15203
15420
  */
15204
- get activationTracks(): Tracks.ActivationTrackHandler[];
15421
+ get activationTracks(): Tracks.TimelineActivationTrack[];
15205
15422
  /**
15206
15423
  * @returns all tracks of the timeline
15207
15424
  */
15208
- get tracks(): ReadonlyArray<Tracks.TrackHandler>;
15425
+ get tracks(): ReadonlyArray<Tracks.TimelineTrackHandler>;
15209
15426
  /**
15210
15427
  * Iterates over all markers of the timeline, optionally filtering by type
15211
15428
  *
@@ -16226,6 +16443,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
16226
16443
  w: number;
16227
16444
  };
16228
16445
 
16446
+ /** A Quaternion value, either as a Three.js Quaternion or as a `[x, y, z, w]` tuple */
16447
+ declare type QuatValue = Quaternion | [number, number, number, number];
16448
+
16229
16449
  /** Generates a random number
16230
16450
  * @deprecated use Mathf.random(min, max)
16231
16451
  */
@@ -16351,6 +16571,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
16351
16571
  * @default undefined
16352
16572
  */
16353
16573
  useIgnoreRaycastLayer?: boolean;
16574
+ /** When true, trigger/sensor colliders will be included in the raycast results.
16575
+ * By default trigger colliders are skipped.
16576
+ * @default false
16577
+ */
16578
+ includeTriggers?: boolean;
16354
16579
  }): null | {
16355
16580
  point: Vector3;
16356
16581
  collider: ICollider;
@@ -16368,6 +16593,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
16368
16593
  * @default undefined
16369
16594
  */
16370
16595
  useIgnoreRaycastLayer?: boolean;
16596
+ /** When true, trigger/sensor colliders will be included in the raycast results.
16597
+ * By default trigger colliders are skipped.
16598
+ * @default false
16599
+ */
16600
+ includeTriggers?: boolean;
16371
16601
  }): null | {
16372
16602
  point: Vector3;
16373
16603
  normal: Vector3;
@@ -19075,7 +19305,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
19075
19305
  reaction: EventList<void>;
19076
19306
  }
19077
19307
 
19078
- export declare class SignalTrackHandler extends TrackHandler {
19308
+ /**
19309
+ * Builder for signal tracks. Provides `.signal()` for callback-based signals and `.marker()` for asset-based markers.
19310
+ * @category Animation and Sequencing
19311
+ */
19312
+ export declare interface SignalTrackBuilder extends TimelineBuilderBase {
19313
+ /** Adds a signal with a callback that fires at the given time */
19314
+ signal(time: number, callback: Function, options?: SignalMarkerOptions): SignalTrackBuilder;
19315
+ /** Adds a signal marker referencing a signal asset by guid */
19316
+ marker(time: number, asset: string, options?: SignalMarkerOptions): SignalTrackBuilder;
19317
+ /** Mutes this track so it is skipped during playback */
19318
+ muted(muted?: boolean): SignalTrackBuilder;
19319
+ }
19320
+
19321
+ export declare class SignalTrackHandler extends TimelineTrackHandler {
19079
19322
  models: Models.SignalMarkerModel[];
19080
19323
  didTrigger: boolean[];
19081
19324
  receivers: Array<SignalReceiver | null>;
@@ -20333,8 +20576,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
20333
20576
  * Configuration for an animation state in the builder
20334
20577
  */
20335
20578
  export declare type StateOptions = {
20336
- /** The animation clip for this state */
20337
- clip: AnimationClip;
20579
+ /**
20580
+ * The animation clip for this state. Accepts:
20581
+ * - A pre-built `AnimationClip`
20582
+ * - A single {@link TrackDescriptor} from {@link track}
20583
+ * - An array of {@link TrackDescriptor}s (multiple tracks combined into one clip)
20584
+ *
20585
+ * When omitted, use {@link AnimatorControllerBuilder.track .track()} to define animation tracks inline.
20586
+ */
20587
+ clip?: AnimationClip | TrackDescriptor | TrackDescriptor[];
20338
20588
  /** Whether the animation should loop (default: false) */
20339
20589
  loop?: boolean;
20340
20590
  /** Base speed multiplier (default: 1) */
@@ -21156,6 +21406,57 @@ export declare class OrbitControls extends Component implements ICameraControlle
21156
21406
  /* Excluded from this release type: update */
21157
21407
  }
21158
21408
 
21409
+ /**
21410
+ * Handles activation (visibility) of bound objects for a timeline activation track.
21411
+ *
21412
+ * Each clip on the track defines a time range during which the bound objects should be active (visible).
21413
+ * @see TimelineTrackHandler for details on how tracks and clips work in general, and how to mutate them at runtime.
21414
+ * @see PlayableDirector for how to control timeline playback and time.
21415
+ * @see TimelineBuilder for how to create and configure timelines and tracks in the editor.
21416
+ */
21417
+ export declare class TimelineActivationTrack extends TimelineTrackHandler {
21418
+ evaluate(time: number): void;
21419
+ }
21420
+
21421
+ export declare class TimelineAnimationTrack extends TimelineTrackHandler {
21422
+ /* Excluded from this release type: models */
21423
+ /* Excluded from this release type: trackOffset */
21424
+ /** The object that is being animated. */
21425
+ target?: Object3D;
21426
+ /** The AnimationMixer, should be shared with the animator if an animator is bound */
21427
+ mixer?: AnimationMixer;
21428
+ clips: Array<AnimationClip>;
21429
+ actions: Array<AnimationAction>;
21430
+ /**
21431
+ * You can use the weight to blend the timeline animation tracks with multiple animation tracks on the same object.
21432
+ * @default 1
21433
+ */
21434
+ weight: number;
21435
+ /** holds data/info about clips differences */
21436
+ private _actionOffsets;
21437
+ private _didBind;
21438
+ private _animator;
21439
+ onDisable(): void;
21440
+ onDestroy(): void;
21441
+ onStateChanged(): void;
21442
+ createHooks(clipModel: Models.AnimationClipModel, clip: any): void;
21443
+ bind(): void;
21444
+ private ensureTrackOffsets;
21445
+ private _useclipOffsets;
21446
+ private _totalOffsetPosition;
21447
+ private _totalOffsetRotation;
21448
+ private _totalOffsetPosition2;
21449
+ private _totalOffsetRotation2;
21450
+ private _summedPos;
21451
+ private _tempPos;
21452
+ private _summedRot;
21453
+ private _tempRot;
21454
+ private _clipRotQuat;
21455
+ evaluate(time: number): void;
21456
+ private createRotationInterpolant;
21457
+ private createPositionInterpolant;
21458
+ }
21459
+
21159
21460
  /**
21160
21461
  * @category Animation and Sequencing
21161
21462
  * @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
@@ -21165,6 +21466,49 @@ export declare class OrbitControls extends Component implements ICameraControlle
21165
21466
  tracks: TrackModel[];
21166
21467
  };
21167
21468
 
21469
+ /**
21470
+ * Handles audio playback for a timeline audio track.
21471
+ *
21472
+ * **Runtime mutation:** The track model is read fresh every frame during `evaluate()`.
21473
+ * You can mutate `track.volume`, `clip.start`, `clip.end`, `clip.asset.volume` etc.
21474
+ * at any time — changes take effect on the next frame without rebuilding the timeline.
21475
+ *
21476
+ * **Audio stopping:** Audio clips are automatically stopped when:
21477
+ * - Timeline time moves outside a clip's `[start, end]` range (e.g. jumping or normal playback advancing past a clip)
21478
+ * - The track is muted (via `muted = true`)
21479
+ * - The director is stopped (`director.stop()`)
21480
+ * - The director is paused (`director.pause()`)
21481
+ * - The director is disabled or destroyed
21482
+ */
21483
+ export declare class TimelineAudioTrack extends TimelineTrackHandler {
21484
+ models: Array<AudioClipModel_2>;
21485
+ listener: AudioListener_3;
21486
+ audio: Array<Audio_2>;
21487
+ audioContextTimeOffset: Array<number>;
21488
+ lastTime: number;
21489
+ audioSource?: AudioSource;
21490
+ /** Track-level volume multiplier (0–1). Applied on top of per-clip volume each frame. */
21491
+ get volume(): number;
21492
+ set volume(val: number);
21493
+ private _audioLoader;
21494
+ private getAudioFilePath;
21495
+ onAllowAudioChanged(allow: boolean): void;
21496
+ addModel(model: Models.ClipModel): void;
21497
+ onDisable(): void;
21498
+ onDestroy(): void;
21499
+ onMuteChanged(): void;
21500
+ stop(): void;
21501
+ private _playableDirectorResumed;
21502
+ onPauseChanged(): void;
21503
+ evaluate(time: number): void;
21504
+ /** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
21505
+ loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
21506
+ private isInTimeRange;
21507
+ private static _audioBuffers;
21508
+ static dispose(): void;
21509
+ private handleAudioLoading;
21510
+ }
21511
+
21168
21512
  /**
21169
21513
  * A fluent builder for creating timeline assets ({@link TimelineAssetModel}) from code.
21170
21514
  *
@@ -21186,6 +21530,19 @@ export declare class OrbitControls extends Component implements ICameraControlle
21186
21530
  * director.play();
21187
21531
  * ```
21188
21532
  *
21533
+ * @example With inline tracks (no pre-built clips needed)
21534
+ * ```ts
21535
+ * TimelineBuilder.create("DoorSequence")
21536
+ * .animationTrack("Door", door)
21537
+ * .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
21538
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
21539
+ * .signalTrack("Events")
21540
+ * .signal(0.5, () => playSound("creak"))
21541
+ * .install(director);
21542
+ *
21543
+ * director.play();
21544
+ * ```
21545
+ *
21189
21546
  * @example Using install() with signal callbacks
21190
21547
  * ```ts
21191
21548
  * TimelineBuilder.create("WithSignals")
@@ -21214,51 +21571,69 @@ export declare class OrbitControls extends Component implements ICameraControlle
21214
21571
  * @param name - Name for the timeline asset
21215
21572
  * @param seed - Optional numeric seed for deterministic guid generation. Defaults to `Date.now()`.
21216
21573
  */
21217
- static create(name?: string, seed?: number): TimelineBuilder;
21574
+ static create(name?: string, seed?: number): TimelineBuilderBase;
21218
21575
  /**
21219
- * Adds an animation track. Subsequent `.clip()` calls add animation clips to this track.
21576
+ * Adds an animation track. Chain `.clip()` calls to add pre-built clips,
21577
+ * or chain `.track()` calls to define animation data inline:
21578
+ *
21579
+ * @example With pre-built AnimationClip
21580
+ * ```ts
21581
+ * .animationTrack("Character", animator)
21582
+ * .clip(walkClip, { duration: 2, easeIn: 0.3 })
21583
+ * .clip(runClip, { duration: 3 })
21584
+ * ```
21585
+ *
21586
+ * @example With inline tracks
21587
+ * ```ts
21588
+ * .animationTrack("Door", door)
21589
+ * .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
21590
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
21591
+ * ```
21592
+ *
21220
21593
  * @param name - Display name for the track
21221
21594
  * @param binding - The Animator or Object3D to animate
21222
21595
  */
21223
- animationTrack(name: string, binding?: Animator | Object3D | null): this;
21596
+ animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
21224
21597
  /**
21225
21598
  * Adds an audio track. Subsequent `.clip()` calls add audio clips to this track.
21226
21599
  * @param name - Display name for the track
21227
21600
  * @param binding - The AudioSource to play audio on (optional)
21228
21601
  * @param volume - Track volume multiplier (default: 1)
21229
21602
  */
21230
- audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): this;
21603
+ audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
21231
21604
  /**
21232
21605
  * Adds an activation track. Subsequent `.clip()` calls define when the bound object is active.
21233
21606
  * @param name - Display name for the track
21234
21607
  * @param binding - The Object3D to show/hide
21235
21608
  */
21236
- activationTrack(name: string, binding?: Object3D | null): this;
21609
+ activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
21237
21610
  /**
21238
21611
  * Adds a control track. Subsequent `.clip()` calls control nested timelines or objects.
21239
21612
  * @param name - Display name for the track
21240
21613
  */
21241
- controlTrack(name: string): this;
21614
+ controlTrack(name: string): ControlTrackBuilder;
21242
21615
  /**
21243
21616
  * Adds a signal track. Use `.signal()` or `.marker()` to add signal markers.
21244
21617
  * @param name - Display name for the track
21245
21618
  * @param binding - The SignalReceiver component (optional — if using `.signal()` with callbacks, one is created automatically by {@link install})
21246
21619
  */
21247
- signalTrack(name: string, binding?: SignalReceiver | Object3D | null): this;
21620
+ signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
21248
21621
  /**
21249
21622
  * Adds a marker track. Use `.marker()` to add markers.
21250
21623
  * @param name - Display name for the track
21251
21624
  */
21252
- markerTrack(name: string): this;
21625
+ markerTrack(name: string): MarkerTrackBuilder;
21253
21626
  /**
21254
21627
  * Adds a clip to the current track. The clip type must match the track type.
21255
21628
  *
21256
- * - On an **animation track**: pass an `AnimationClip` and optional {@link AnimationClipOptions}
21629
+ * - On an **animation track**: pass an `AnimationClip`, a {@link TrackDescriptor}, or a `TrackDescriptor[]` and optional {@link AnimationClipOptions}
21257
21630
  * - On an **audio track**: pass a clip URL (string) and {@link AudioClipOptions}
21258
21631
  * - On an **activation track**: pass {@link ActivationClipOptions}
21259
21632
  * - On a **control track**: pass an Object3D and {@link ControlClipOptions}
21260
21633
  */
21261
21634
  clip(asset: AnimationClip, options?: AnimationClipOptions): this;
21635
+ clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): this;
21636
+ clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): this;
21262
21637
  clip(url: string, options: AudioClipOptions): this;
21263
21638
  clip(options: ActivationClipOptions): this;
21264
21639
  clip(sourceObject: Object3D, options: ControlClipOptions): this;
@@ -21293,6 +21668,24 @@ export declare class OrbitControls extends Component implements ICameraControlle
21293
21668
  * Mutes the current track so it is skipped during playback.
21294
21669
  */
21295
21670
  muted(muted?: boolean): this;
21671
+ /** Adds an animation track descriptor for an Object3D's position or scale to the current animation track */
21672
+ track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): this;
21673
+ /** Adds an animation track descriptor for an Object3D's quaternion to the current animation track */
21674
+ track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): this;
21675
+ /** Adds an animation track descriptor for an Object3D's rotation (Euler, converted to quaternion) to the current animation track */
21676
+ track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): this;
21677
+ /** Adds an animation track descriptor for an Object3D's visibility to the current animation track */
21678
+ track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): this;
21679
+ /** Adds an animation track descriptor for a material's numeric property to the current animation track */
21680
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): this;
21681
+ /** Adds an animation track descriptor for a material's color property to the current animation track */
21682
+ track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
21683
+ /** Adds an animation track descriptor for a light's numeric property to the current animation track */
21684
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): this;
21685
+ /** Adds an animation track descriptor for a light's color to the current animation track */
21686
+ track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
21687
+ /** Adds an animation track descriptor for a camera's numeric property to the current animation track */
21688
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): this;
21296
21689
  /**
21297
21690
  * Builds and returns the {@link TimelineAssetModel}.
21298
21691
  * Assign the result to `PlayableDirector.playableAsset` to play it.
@@ -21323,6 +21716,73 @@ export declare class OrbitControls extends Component implements ICameraControlle
21323
21716
  */
21324
21717
  install(director: PlayableDirector): TimelineAssetModel;
21325
21718
  private pushTrack;
21719
+ /** Commits any pending `.track()` descriptors on the current animation track into a clip */
21720
+ private commitInlineTracks;
21721
+ }
21722
+
21723
+ /**
21724
+ * Shared methods available on all track builders and the TimelineBuilder entry point.
21725
+ * Provides track creation, build, and install methods.
21726
+ *
21727
+ * @category Animation and Sequencing
21728
+ */
21729
+ export declare interface TimelineBuilderBase {
21730
+ /** Adds an animation track. Chain `.clip()` or `.track()` to add content. */
21731
+ animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
21732
+ /** Adds an audio track. Chain `.clip()` to add audio clips. */
21733
+ audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
21734
+ /** Adds an activation track. Chain `.clip()` to define activation windows. */
21735
+ activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
21736
+ /** Adds a control track. Chain `.clip()` to control nested objects/timelines. */
21737
+ controlTrack(name: string): ControlTrackBuilder;
21738
+ /** Adds a signal track. Chain `.signal()` or `.marker()` to add events. */
21739
+ signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
21740
+ /** Adds a marker track. Chain `.marker()` to add markers. */
21741
+ markerTrack(name: string): MarkerTrackBuilder;
21742
+ /** Builds and returns the {@link TimelineAssetModel}. */
21743
+ build(): TimelineAssetModel;
21744
+ /** Builds the timeline, assigns it to the director, and wires up signal callbacks. */
21745
+ install(director: PlayableDirector): TimelineAssetModel;
21746
+ }
21747
+
21748
+ export declare class TimelineControlTrack extends TimelineTrackHandler {
21749
+ models: Array<Models.ClipModel>;
21750
+ timelines: Array<PlayableDirector | null>;
21751
+ resolveSourceObjects(_context: Context): void;
21752
+ private _previousActiveModel;
21753
+ evaluate(time: number): void;
21754
+ }
21755
+
21756
+ export declare class TimelineMarkerTrack extends TimelineTrackHandler {
21757
+ models: Array<Models.MarkerModel & Record<string, any>>;
21758
+ needsSorting: boolean;
21759
+ foreachMarker<T>(type?: string | null): Generator<T, void, unknown>;
21760
+ onEnable(): void;
21761
+ evaluate(_time: number): void;
21762
+ private sort;
21763
+ }
21764
+
21765
+ /**
21766
+ * A TrackHandler is responsible for evaluating a specific type of timeline track.
21767
+ * A timeline track can be an animation track, audio track, signal track, control track etc and is controlled by a {@link PlayableDirector}.
21768
+ */
21769
+ export declare abstract class TimelineTrackHandler {
21770
+ director: PlayableDirector;
21771
+ track: Models.TrackModel;
21772
+ get muted(): boolean;
21773
+ set muted(val: boolean);
21774
+ forEachClip(backwards?: boolean): IterableIterator<Models.ClipModel>;
21775
+ onEnable?(): any;
21776
+ onDisable?(): any;
21777
+ onDestroy?(): any;
21778
+ abstract evaluate(time: number): any;
21779
+ onMuteChanged?(): any;
21780
+ onPauseChanged?(): any;
21781
+ /** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
21782
+ onStateChanged?(isPlaying: boolean): any;
21783
+ getClipTime(time: number, model: Models.ClipModel): number;
21784
+ getClipTimeNormalized(time: number, model: Models.ClipModel): number;
21785
+ evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
21326
21786
  }
21327
21787
 
21328
21788
  declare type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
@@ -21353,27 +21813,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
21353
21813
  export declare function toSourceId(src: string | null): SourceIdentifier | undefined;
21354
21814
 
21355
21815
  /**
21356
- * A TrackHandler is responsible for evaluating a specific type of timeline track.
21357
- * A timeline track can be an animation track, audio track, signal track, control track etc and is controlled by a {@link PlayableDirector}.
21816
+ * An opaque descriptor for a single animation track.
21817
+ * Created by {@link track} and resolved into a Three.js KeyframeTrack
21818
+ * when passed to {@link createAnimation}, or inline to
21819
+ * {@link AnimatorControllerBuilder.state} / {@link TimelineBuilder.clip}.
21820
+ *
21821
+ * @category Animation and Sequencing
21358
21822
  */
21359
- export declare abstract class TrackHandler {
21360
- director: PlayableDirector;
21361
- track: Models.TrackModel;
21362
- get muted(): boolean;
21363
- set muted(val: boolean);
21364
- forEachClip(backwards?: boolean): IterableIterator<Models.ClipModel>;
21365
- onEnable?(): any;
21366
- onDisable?(): any;
21367
- onDestroy?(): any;
21368
- abstract evaluate(time: number): any;
21369
- onMuteChanged?(): any;
21370
- onPauseChanged?(): any;
21371
- /** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
21372
- onStateChanged?(isPlaying: boolean): any;
21373
- getClipTime(time: number, model: Models.ClipModel): number;
21374
- getClipTimeNormalized(time: number, model: Models.ClipModel): number;
21375
- evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
21376
- }
21823
+ declare type TrackDescriptor = {
21824
+ readonly __isTrackDescriptor: true;
21825
+ /* Excluded from this release type: _target */
21826
+ /* Excluded from this release type: _property */
21827
+ /* Excluded from this release type: _keyframes */
21828
+ /* Excluded from this release type: _root */
21829
+ };
21377
21830
 
21378
21831
  /**
21379
21832
  * @category Animation and Sequencing
@@ -21399,15 +21852,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
21399
21852
  rotation: Quat | Quaternion;
21400
21853
  };
21401
21854
 
21855
+ /** Options for a single track */
21856
+ declare type TrackOptions = {
21857
+ /**
21858
+ * Root object for resolving the track path.
21859
+ * - If `root === target` → self-targeting (`.property`)
21860
+ * - If `root !== target` → named targeting (`"targetName.property"` using `target.name`)
21861
+ * - If omitted → self-targeting by default
21862
+ */
21863
+ root?: Object3D;
21864
+ };
21865
+
21402
21866
  declare namespace Tracks {
21403
21867
  export {
21404
- TrackHandler,
21405
- AnimationTrackHandler,
21406
- AudioTrackHandler,
21407
- MarkerTrackHandler,
21868
+ TimelineTrackHandler,
21869
+ TimelineAnimationTrack,
21870
+ TimelineAudioTrack,
21871
+ TimelineMarkerTrack,
21408
21872
  SignalTrackHandler,
21409
- ActivationTrackHandler,
21410
- ControlTrackHandler
21873
+ TimelineActivationTrack,
21874
+ TimelineControlTrack
21411
21875
  }
21412
21876
  }
21413
21877
 
@@ -21613,10 +22077,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
21613
22077
  export declare type TransitionOptions = {
21614
22078
  /** Duration of the crossfade in seconds (default: 0) */
21615
22079
  duration?: number;
21616
- /** Normalized exit time 0-1 (default: 1). Only used when hasExitTime is true */
22080
+ /** Normalized exit time 0-1. When set, the transition waits until the source animation reaches this point before transitioning. */
21617
22081
  exitTime?: number;
21618
- /** Whether the transition waits for exitTime before transitioning (default: false) */
21619
- hasExitTime?: boolean;
21620
22082
  /** Normalized offset into the destination state's animation (default: 0) */
21621
22083
  offset?: number;
21622
22084
  /** Whether duration is in seconds (true) or normalized (false) (default: false) */
@@ -21686,6 +22148,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
21686
22148
 
21687
22149
  export declare function tryGetGuid(obj: any): string | undefined | null;
21688
22150
 
22151
+ /** Shorthand for a simple two-keyframe animation (start → end) */
22152
+ export declare type Tween<V> = {
22153
+ /** Start value (at time 0) */
22154
+ from: V;
22155
+ /** End value (at time = duration) */
22156
+ to: V;
22157
+ /** Duration in seconds (default: 1) */
22158
+ duration?: number;
22159
+ /** Interpolation mode (default: `"linear"`) */
22160
+ interpolation?: AnimationInterpolation;
22161
+ };
22162
+
21689
22163
  declare type Type = new (...args: any[]) => any;
21690
22164
 
21691
22165
  declare type TypeResolver<T> = (data: any) => Constructor<T> | null;
@@ -22209,6 +22683,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
22209
22683
  z: number;
22210
22684
  };
22211
22685
 
22686
+ /** A Vector3 value, either as a Three.js Vector3 or as a `[x, y, z]` tuple */
22687
+ declare type Vec3Value = Vector3 | [number, number, number];
22688
+
22212
22689
  export declare type Vec4 = {
22213
22690
  x: number;
22214
22691
  y: number;
@@ -23524,6 +24001,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
23524
24001
  * @link https://github.com/immersive-web/marker-tracking/blob/main/explainer.md - WebXR Marker Tracking Specification
23525
24002
  */
23526
24003
  export declare class WebXRImageTracking extends Component {
24004
+ /**
24005
+ * Event invoked every frame when images are being tracked.
24006
+ * @example
24007
+ * ```ts
24008
+ * const tracker = this.gameObject.getComponent(WebXRImageTracking);
24009
+ * tracker?.imageTracked.addEventListener(evt => {
24010
+ * for (const img of evt.trackedImages) {
24011
+ * console.log(img.url, img.state);
24012
+ * }
24013
+ * });
24014
+ * ```
24015
+ */
24016
+ imageTracked: EventList<WebXRImageTrackingEvent>;
24017
+ /** @inheritdoc */
24018
+ addEventListener<K extends keyof WebXRImageTrackingEventMap>(type: K, listener: (evt: WebXRImageTrackingEventMap[K]) => any): void;
24019
+ addEventListener<T extends Event>(type: string, listener: (evt: T) => any): void;
24020
+ /** @inheritdoc */
24021
+ removeEventListener<K extends keyof WebXRImageTrackingEventMap>(type: K, listener: (evt: WebXRImageTrackingEventMap[K]) => any): void;
24022
+ removeEventListener<T extends Event>(type: string, listener: (evt: T) => any): void;
23527
24023
  /**
23528
24024
  * Set which marker should be primary (first in the list).
23529
24025
  * Useful when deploying to QuickLook mode where one marker is tracked at a time.
@@ -23610,6 +24106,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
23610
24106
  private onImageTrackingUpdate;
23611
24107
  }
23612
24108
 
24109
+ /** Data passed to image tracking event listeners. */
24110
+ export declare interface WebXRImageTrackingEvent {
24111
+ /** The images currently being tracked this frame. */
24112
+ readonly trackedImages: readonly WebXRTrackedImage[];
24113
+ }
24114
+
24115
+ /** Event map for {@link WebXRImageTracking} events. Use with `addEventListener` for typed event handling. */
24116
+ export declare interface WebXRImageTrackingEventMap {
24117
+ /** Dispatched every frame when images are being tracked. The event detail contains the tracking data for the current frame. */
24118
+ "image-tracking": CustomEvent<WebXRImageTrackingEvent>;
24119
+ }
24120
+
23613
24121
  /**
23614
24122
  * Configuration model for a tracked image marker.
23615
24123
  * Defines which image to track, its physical size, and which 3D content to display when detected.
@@ -23808,8 +24316,39 @@ export declare class OrbitControls extends Component implements ICameraControlle
23808
24316
  get widthInMeters(): number;
23809
24317
  /** The ImageBitmap used for tracking */
23810
24318
  get bitmap(): ImageBitmap;
23811
- /** The {@link WebXRImageTrackingModel} configuration for this tracked image */
24319
+ /**
24320
+ * The {@link WebXRImageTrackingModel} configuration for this tracked image.
24321
+ * Use this to access the assigned 3D object, marker settings, and other image tracking configuration.
24322
+ * Available on each {@link WebXRTrackedImage} received from the `image-tracking` {@link CustomEvent} (`event.detail`).
24323
+ * @example
24324
+ * ```ts
24325
+ * tracker.addEventListener("image-tracking", event => {
24326
+ * for (const img of event.detail.trackedImages) {
24327
+ * const model = img.model;
24328
+ * // Access the assigned 3D object
24329
+ * const obj = model.object;
24330
+ * // Access other settings
24331
+ * console.log(model.widthInMeters, model.hideWhenTrackingIsLost);
24332
+ * }
24333
+ * });
24334
+ * ```
24335
+ */
23812
24336
  get model(): WebXRImageTrackingModel;
24337
+ /**
24338
+ * The 3D object or prefab assigned to this tracked image marker in the {@link WebXRImageTrackingModel}.
24339
+ * Use this to access the object associated with an AR image tracking marker from the `image-tracking` {@link CustomEvent}.
24340
+ * Shorthand for `this.model.object`.
24341
+ * @example
24342
+ * ```ts
24343
+ * tracker.addEventListener("image-tracking", event => {
24344
+ * for (const img of event.detail.trackedImages) {
24345
+ * const obj = img.trackedModel;
24346
+ * // verbose alternative: img.model.object
24347
+ * }
24348
+ * });
24349
+ * ```
24350
+ */
24351
+ get trackedModel(): AssetReference | undefined;
23813
24352
  /**
23814
24353
  * The measured size of the detected image in the real world.
23815
24354
  * May differ from `widthInMeters` if the physical marker doesn't match the configured size.