laymur 0.11.4 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +33 -29
  2. package/dist/constraints/{UIAspectConstraint.Internal.d.ts → UIAspectConstraint/UIAspectConstraint.Internal.d.ts} +1 -1
  3. package/dist/constraints/{UIAspectConstraint.d.ts → UIAspectConstraint/UIAspectConstraint.d.ts} +2 -2
  4. package/dist/constraints/UIConstraint.d.ts +2 -2
  5. package/dist/constraints/UICustomConstraint.d.ts +3 -3
  6. package/dist/constraints/{UIHeightConstraint.Internal.d.ts → UIHeightConstraint/UIHeightConstraint.Internal.d.ts} +1 -1
  7. package/dist/constraints/{UIHeightConstraint.d.ts → UIHeightConstraint/UIHeightConstraint.d.ts} +2 -2
  8. package/dist/constraints/{UIHorizontalDistanceConstraint.Internal.d.ts → UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts} +1 -1
  9. package/dist/constraints/{UIHorizontalDistanceConstraint.d.ts → UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts} +2 -2
  10. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +14 -0
  11. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +44 -0
  12. package/dist/constraints/{UIHorizontalProportionConstraint.Internal.d.ts → UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts} +1 -1
  13. package/dist/constraints/{UIHorizontalProportionConstraint.d.ts → UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts} +2 -2
  14. package/dist/constraints/{UISingleParameterConstraint.Internal.d.ts → UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +5 -3
  15. package/dist/constraints/{UISingleParameterConstraint.d.ts → UISingleParameterConstraint/UISingleParameterConstraint.d.ts} +5 -5
  16. package/dist/constraints/{UIVerticalDistanceConstraint.Internal.d.ts → UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts} +1 -1
  17. package/dist/constraints/{UIVerticalDistanceConstraint.d.ts → UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts} +2 -2
  18. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +14 -0
  19. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +44 -0
  20. package/dist/constraints/{UIVerticalProportionConstraint.Internal.d.ts → UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts} +1 -1
  21. package/dist/constraints/{UIVerticalProportionConstraint.d.ts → UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts} +2 -2
  22. package/dist/constraints/{UIWidthConstraint.Internal.d.ts → UIWidthConstraint/UIWidthConstraint.Internal.d.ts} +1 -1
  23. package/dist/constraints/{UIWidthConstraint.d.ts → UIWidthConstraint/UIWidthConstraint.d.ts} +2 -2
  24. package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +21 -2
  25. package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +19 -8
  26. package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +6 -6
  27. package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +6 -6
  28. package/dist/elements/UIAnchor/UIAnchor.d.ts +2 -2
  29. package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +15 -3
  30. package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +12 -6
  31. package/dist/elements/UIElement/UIElement.d.ts +1 -1
  32. package/dist/elements/UIGraphics/UIGraphics.Internal.d.ts +0 -2
  33. package/dist/elements/UIGraphics/UIGraphics.d.ts +2 -2
  34. package/dist/elements/UIImage/UIImage.Internal.d.ts +0 -2
  35. package/dist/elements/UIImage/UIImage.d.ts +2 -2
  36. package/dist/elements/UIInputDummy/UIInputDummy.d.ts +2 -2
  37. package/dist/elements/UINineSlice/UINineSlice.d.ts +10 -6
  38. package/dist/elements/UIProgress/UIProgress.Internal.d.ts +0 -2
  39. package/dist/elements/UIProgress/UIProgress.d.ts +3 -3
  40. package/dist/elements/UIScene/UIScene.d.ts +1 -1
  41. package/dist/elements/UIText/UIText.d.ts +2 -2
  42. package/dist/index.d.ts +12 -9
  43. package/dist/index.js +851 -277
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.min.js +1 -1
  46. package/dist/index.min.js.map +1 -1
  47. package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +9 -0
  48. package/dist/layers/{UIFullscreenLayer.d.ts → UIFullscreenLayer/UIFullscreenLayer.d.ts} +4 -8
  49. package/dist/layers/UILayer/UILayer.Internal.d.ts +29 -0
  50. package/dist/layers/{UILayer.d.ts → UILayer/UILayer.d.ts} +4 -9
  51. package/dist/miscellaneous/asserts.d.ts +22 -55
  52. package/dist/miscellaneous/color/UIColor.d.ts +1 -0
  53. package/dist/miscellaneous/shared.d.ts +46 -0
  54. package/package.json +6 -3
  55. package/dist/layers/UILayer.Internal.d.ts +0 -15
package/README.md CHANGED
@@ -39,11 +39,11 @@ Requires Three.js >=0.175.0 <0.180.0 as a peer dependency.
39
39
  ## Quick Example
40
40
 
41
41
  ```typescript
42
- import { UIFullscreenLayer, UIImage, UIText, UIWidthConstraint } from 'laymur';
42
+ import { UIFullscreenLayer, UIImage, UIText } from 'laymur';
43
43
  import { WebGLRenderer, TextureLoader, Clock } from 'three';
44
44
 
45
45
  const renderer = new WebGLRenderer();
46
- const layer = new UIFullscreenLayer(1920, 1920);
46
+ const layer = new UIFullscreenLayer();
47
47
  const clock = new Clock();
48
48
 
49
49
  const texture = new TextureLoader().load('background.jpg');
@@ -51,7 +51,7 @@ const background = new UIImage(layer, texture, { x: 0, y: 0 });
51
51
  const title = new UIText(layer, 'Mobile Ad Title', {
52
52
  x: 100,
53
53
  y: 100,
54
- maxWidth: 800
54
+ maxLineWidth: 800
55
55
  });
56
56
 
57
57
  function animate() {
@@ -66,7 +66,6 @@ animate();
66
66
 
67
67
  ### Layers
68
68
  - **UIFullscreenLayer** - Handles browser window scaling
69
- - **UILayer** - Base layer for custom setups
70
69
 
71
70
  ### Elements
72
71
  - **UIImage** - Display textures
@@ -83,6 +82,7 @@ animate();
83
82
  - **UIAspectConstraint** - Maintain aspect ratios
84
83
  - **UIHorizontalDistanceConstraint** / **UIVerticalDistanceConstraint** - Spacing between elements
85
84
  - **UIHorizontalProportionConstraint** / **UIVerticalProportionConstraint** - Proportional sizing
85
+ - **UIHorizontalInterpolationConstraint** / **UIVerticalInterpolationConstraint** - Position element between two anchors
86
86
  - **UICustomConstraint** - Custom constraint expressions
87
87
  - **UIFitConstraintBuilder** - Fit element inside container (like CSS object-fit: contain)
88
88
  - **UICoverConstraintBuilder** - Cover container with element (like CSS object-fit: cover)
@@ -108,25 +108,6 @@ new UIHorizontalDistanceConstraint(sidebar, content, {
108
108
  });
109
109
  ```
110
110
 
111
- ## Responsive Design
112
-
113
- Handle different orientations:
114
-
115
- ```typescript
116
- import { UIOrientation } from 'laymur';
117
-
118
- // Different widths for landscape vs portrait
119
- new UIWidthConstraint(sidebar, {
120
- width: 300,
121
- orientation: UIOrientation.HORIZONTAL
122
- });
123
-
124
- new UIWidthConstraint(sidebar, {
125
- width: 200,
126
- orientation: UIOrientation.VERTICAL
127
- });
128
- ```
129
-
130
111
  ## Text Rendering
131
112
 
132
113
  Text supports styled spans with different fonts, sizes, and colors:
@@ -140,7 +121,7 @@ const text = new UIText(layer, [
140
121
  ], {
141
122
  x: 100,
142
123
  y: 100,
143
- maxLineWidth: 600,
124
+ maxLineWidth: 600
144
125
  });
145
126
  ```
146
127
 
@@ -149,7 +130,7 @@ const text = new UIText(layer, [
149
130
  Apply visual transformations without affecting the constraint layout:
150
131
 
151
132
  ```typescript
152
- const element = new UIImage(layer, texture);
133
+ const element = new UIImage(layer, texture, { x: 0, y: 0 });
153
134
 
154
135
  // Apply transformations for animations
155
136
  element.micro.x = 10;
@@ -163,14 +144,37 @@ element.micro.reset();
163
144
 
164
145
  ## Event Handling
165
146
 
147
+ UI elements with area (width and height) can emit input events. Layers can also emit input events.
148
+
166
149
  ```typescript
167
150
  import { UIInputEvent, UIMode } from 'laymur';
168
151
 
169
- const button = new UIImage(layer, buttonTexture);
170
- button.mode = UIMode.INTERACTIVE;
152
+ // Element events
153
+ const button = new UIImage(layer, buttonTexture, {
154
+ x: 0,
155
+ y: 0,
156
+ mode: UIMode.INTERACTIVE
157
+ });
158
+
159
+ button.on(UIInputEvent.PRESSED, (x, y, element) => {
160
+ console.log('Button pressed at', x, y);
161
+ });
162
+
163
+ button.on(UIInputEvent.RELEASED, (x, y, element) => {
164
+ console.log('Button released');
165
+ });
166
+
167
+ button.on(UIInputEvent.ENTERED, (x, y, element) => {
168
+ console.log('Pointer entered button');
169
+ });
170
+
171
+ // Layer events
172
+ layer.on(UIInputEvent.PRESSED, (x, y) => {
173
+ console.log('Layer pressed at', x, y);
174
+ });
171
175
 
172
- button.on(UIInputEvent.CLICK, (x, y, element) => {
173
- console.log('Button clicked');
176
+ layer.on(UIInputEvent.MOVED, (x, y) => {
177
+ console.log('Pointer moved to', x, y);
174
178
  });
175
179
  ```
176
180
 
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  /** Aspect constraint options */
3
3
  export interface UIAspectConstraintOptions extends UISingleParameterConstraintOptions {
4
4
  /** Target aspect ratio (width/height) */
@@ -1,6 +1,6 @@
1
- import type { UILayerElement, UIPlaneElement } from "../miscellaneous/asserts";
1
+ import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
2
3
  import type { UIAspectConstraintOptions } from "./UIAspectConstraint.Internal";
3
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
4
4
  /** Maintains element aspect ratio (width = height * aspect) */
5
5
  export declare class UIAspectConstraint extends UISingleParameterConstraint {
6
6
  private readonly element;
@@ -1,4 +1,4 @@
1
- import type { UILayer } from "../layers/UILayer";
1
+ import type { UILayer } from "../layers/UILayer/UILayer";
2
2
  import type { UISolverWrapperInterface } from "../wrappers/UISolverWrapper.Internal";
3
3
  /** Base class for layout constraints */
4
4
  export declare abstract class UIConstraint {
@@ -8,5 +8,5 @@ export declare abstract class UIConstraint {
8
8
  /** Constraint solver wrapper */
9
9
  protected readonly solverWrapper: UISolverWrapperInterface;
10
10
  /** @param layer Layer containing this constraint */
11
- constructor(layer: UILayer);
11
+ constructor(layer: UILayer, name?: string);
12
12
  }
@@ -1,7 +1,7 @@
1
- import type { UILayer } from "../layers/UILayer";
1
+ import type { UILayer } from "../layers/UILayer/UILayer";
2
2
  import type { UIExpression } from "../miscellaneous/UIExpression";
3
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
4
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
3
+ import { UISingleParameterConstraint } from "./UISingleParameterConstraint/UISingleParameterConstraint";
4
+ import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint/UISingleParameterConstraint.Internal";
5
5
  /** Constraint with custom LHS and RHS expressions */
6
6
  export declare class UICustomConstraint extends UISingleParameterConstraint {
7
7
  /** Solver constraint descriptor */
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  /** Height constraint options */
3
3
  export interface UIHeightConstraintOptions extends UISingleParameterConstraintOptions {
4
4
  /** Target height in world units */
@@ -1,6 +1,6 @@
1
- import type { UILayerElement, UIPlaneElement } from "../miscellaneous/asserts";
1
+ import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
2
3
  import type { UIHeightConstraintOptions } from "./UIHeightConstraint.Internal";
3
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
4
4
  /** Fixes element height to constant value */
5
5
  export declare class UIHeightConstraint extends UISingleParameterConstraint {
6
6
  private readonly element;
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  export declare const DEFAULT_ANCHOR = 0.5;
3
3
  /** Horizontal distance constraint options */
4
4
  export interface UIHorizontalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
@@ -1,6 +1,6 @@
1
- import type { UIPlaneElement, UIPointElement } from "../miscellaneous/asserts";
1
+ import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
2
3
  import type { UIHorizontalDistanceConstraintOptions } from "./UIHorizontalDistanceConstraint.Internal";
3
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
4
4
  /** Maintains horizontal distance between elements with configurable anchors */
5
5
  export declare class UIHorizontalDistanceConstraint extends UISingleParameterConstraint {
6
6
  private readonly a;
@@ -0,0 +1,14 @@
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
+ export declare const DEFAULT_ANCHOR = 0.5;
3
+ export declare const DEFAULT_T = 0.5;
4
+ /** Horizontal interpolation constraint options */
5
+ export interface UIHorizontalInterpolationConstraintOptions extends UISingleParameterConstraintOptions {
6
+ /** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
7
+ anchorA: number;
8
+ /** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
9
+ anchorB: number;
10
+ /** Anchor on element C (0 = left, 0.5 = center, 1 = right) */
11
+ anchorC: number;
12
+ /** Interpolation factor (0 = A position, 1 = B position) */
13
+ t: number;
14
+ }
@@ -0,0 +1,44 @@
1
+ import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
+ import type { UIHorizontalInterpolationConstraintOptions } from "./UIHorizontalInterpolationConstraint.Internal";
4
+ /** Positions element C horizontally between A and B based on interpolation factor */
5
+ export declare class UIHorizontalInterpolationConstraint extends UISingleParameterConstraint {
6
+ private readonly a;
7
+ private readonly b;
8
+ private readonly c;
9
+ /** Solver constraint descriptor */
10
+ protected readonly constraint: number;
11
+ /** Anchor on element A */
12
+ private anchorAInternal;
13
+ /** Anchor on element B */
14
+ private anchorBInternal;
15
+ /** Anchor on element C */
16
+ private anchorCInternal;
17
+ /** Interpolation factor */
18
+ private tInternal;
19
+ /**
20
+ * @param a First element
21
+ * @param b Second element
22
+ * @param c Element to position between A and B
23
+ * @param options Interpolation configuration
24
+ */
25
+ constructor(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, c: UIPointElement | UIPlaneElement, options?: Partial<UIHorizontalInterpolationConstraintOptions>);
26
+ /** Interpolation factor (0 = A position, 1 = B position) */
27
+ get t(): number;
28
+ /** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
29
+ get anchorA(): number;
30
+ /** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
31
+ get anchorB(): number;
32
+ /** Anchor on element C (0 = left, 0.5 = center, 1 = right) */
33
+ get anchorC(): number;
34
+ /** Updates interpolation factor */
35
+ set t(value: number);
36
+ /** Updates anchor on element A */
37
+ set anchorA(value: number);
38
+ /** Updates anchor on element B */
39
+ set anchorB(value: number);
40
+ /** Updates anchor on element C */
41
+ set anchorC(value: number);
42
+ /** Builds constraint expression: C - A*(1-t) - B*t = 0 */
43
+ private buildLHS;
44
+ }
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  /** Horizontal proportion constraint options */
3
3
  export interface UIHorizontalProportionConstraintOptions extends UISingleParameterConstraintOptions {
4
4
  /** Proportion multiplier (A.width * proportion = B.width) */
@@ -1,6 +1,6 @@
1
- import type { UIPlaneElement } from "../miscellaneous/asserts";
1
+ import type { UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
2
3
  import type { UIHorizontalProportionConstraintOptions } from "./UIHorizontalProportionConstraint.Internal";
3
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
4
4
  /** Maintains proportional width relationship (A.width * proportion = B.width) */
5
5
  export declare class UIHorizontalProportionConstraint extends UISingleParameterConstraint {
6
6
  private readonly a;
@@ -1,8 +1,10 @@
1
- import type { UIOrientation } from "../miscellaneous/UIOrientation";
2
- import type { UIPriority } from "../miscellaneous/UIPriority";
3
- import type { UIRelation } from "../miscellaneous/UIRelation";
1
+ import type { UIOrientation } from "../../miscellaneous/UIOrientation";
2
+ import type { UIPriority } from "../../miscellaneous/UIPriority";
3
+ import type { UIRelation } from "../../miscellaneous/UIRelation";
4
4
  /** Single parameter constraint options */
5
5
  export interface UISingleParameterConstraintOptions {
6
+ /** Constraint name */
7
+ name: string;
6
8
  /** Constraint priority */
7
9
  priority: UIPriority;
8
10
  /** Constraint relation */
@@ -1,8 +1,8 @@
1
- import type { UILayer } from "../layers/UILayer";
2
- import { UIOrientation } from "../miscellaneous/UIOrientation";
3
- import type { UIPriority } from "../miscellaneous/UIPriority";
4
- import type { UIRelation } from "../miscellaneous/UIRelation";
5
- import { UIConstraint } from "./UIConstraint";
1
+ import type { UILayer } from "../../layers/UILayer/UILayer";
2
+ import { UIOrientation } from "../../miscellaneous/UIOrientation";
3
+ import type { UIPriority } from "../../miscellaneous/UIPriority";
4
+ import type { UIRelation } from "../../miscellaneous/UIRelation";
5
+ import { UIConstraint } from "../UIConstraint";
6
6
  import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
7
7
  /** Base class for constraints with priority, relation, and orientation */
8
8
  export declare abstract class UISingleParameterConstraint extends UIConstraint {
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  export declare const DEFAULT_ANCHOR = 0.5;
3
3
  /** Vertical distance constraint options */
4
4
  export interface UIVerticalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
@@ -1,5 +1,5 @@
1
- import type { UIPlaneElement, UIPointElement } from "../miscellaneous/asserts";
2
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
1
+ import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
3
  import type { UIVerticalDistanceConstraintOptions } from "./UIVerticalDistanceConstraint.Internal";
4
4
  /** Maintains vertical distance between elements with configurable anchors */
5
5
  export declare class UIVerticalDistanceConstraint extends UISingleParameterConstraint {
@@ -0,0 +1,14 @@
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
+ export declare const DEFAULT_ANCHOR = 0.5;
3
+ export declare const DEFAULT_T = 0.5;
4
+ /** Vertical interpolation constraint options */
5
+ export interface UIVerticalInterpolationConstraintOptions extends UISingleParameterConstraintOptions {
6
+ /** Anchor on element A (0 = bottom, 0.5 = center, 1 = top) */
7
+ anchorA: number;
8
+ /** Anchor on element B (0 = bottom, 0.5 = center, 1 = top) */
9
+ anchorB: number;
10
+ /** Anchor on element C (0 = bottom, 0.5 = center, 1 = top) */
11
+ anchorC: number;
12
+ /** Interpolation factor (0 = A position, 1 = B position) */
13
+ t: number;
14
+ }
@@ -0,0 +1,44 @@
1
+ import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
+ import type { UIVerticalInterpolationConstraintOptions } from "./UIVerticalInterpolationConstraint.Internal";
4
+ /** Positions element C vertically between A and B based on interpolation factor */
5
+ export declare class UIVerticalInterpolationConstraint extends UISingleParameterConstraint {
6
+ private readonly a;
7
+ private readonly b;
8
+ private readonly c;
9
+ /** Solver constraint descriptor */
10
+ protected readonly constraint: number;
11
+ /** Anchor on element A */
12
+ private anchorAInternal;
13
+ /** Anchor on element B */
14
+ private anchorBInternal;
15
+ /** Anchor on element C */
16
+ private anchorCInternal;
17
+ /** Interpolation factor */
18
+ private tInternal;
19
+ /**
20
+ * @param a First element
21
+ * @param b Second element
22
+ * @param c Element to position between A and B
23
+ * @param options Interpolation configuration
24
+ */
25
+ constructor(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, c: UIPointElement | UIPlaneElement, options?: Partial<UIVerticalInterpolationConstraintOptions>);
26
+ /** Interpolation factor (0 = A position, 1 = B position) */
27
+ get t(): number;
28
+ /** Anchor on element A (0 = bottom, 0.5 = center, 1 = top) */
29
+ get anchorA(): number;
30
+ /** Anchor on element B (0 = bottom, 0.5 = center, 1 = top) */
31
+ get anchorB(): number;
32
+ /** Anchor on element C (0 = bottom, 0.5 = center, 1 = top) */
33
+ get anchorC(): number;
34
+ /** Updates interpolation factor */
35
+ set t(value: number);
36
+ /** Updates anchor on element A */
37
+ set anchorA(value: number);
38
+ /** Updates anchor on element B */
39
+ set anchorB(value: number);
40
+ /** Updates anchor on element C */
41
+ set anchorC(value: number);
42
+ /** Builds constraint expression: C - A*(1-t) - B*t = 0 */
43
+ private buildLHS;
44
+ }
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  /** Vertical proportion constraint options */
3
3
  export interface UIVerticalProportionConstraintOptions extends UISingleParameterConstraintOptions {
4
4
  /** Proportion multiplier (A.height * proportion = B.height) */
@@ -1,5 +1,5 @@
1
- import type { UIPlaneElement } from "../miscellaneous/asserts";
2
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
1
+ import type { UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
3
  import type { UIVerticalProportionConstraintOptions } from "./UIVerticalProportionConstraint.Internal";
4
4
  /** Maintains proportional height relationship (A.height * proportion = B.height) */
5
5
  export declare class UIVerticalProportionConstraint extends UISingleParameterConstraint {
@@ -1,4 +1,4 @@
1
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
1
+ import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
2
  /** Width constraint options */
3
3
  export interface UIWidthConstraintOptions extends UISingleParameterConstraintOptions {
4
4
  /** Target width in world units */
@@ -1,5 +1,5 @@
1
- import type { UILayerElement, UIPlaneElement } from "../miscellaneous/asserts";
2
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
1
+ import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
3
  import type { UIWidthConstraintOptions } from "./UIWidthConstraint.Internal";
4
4
  /** Fixes element width to constant value */
5
5
  export declare class UIWidthConstraint extends UISingleParameterConstraint {
@@ -1,13 +1,21 @@
1
1
  import type { UIOrientation } from "../../miscellaneous/UIOrientation";
2
2
  import type { UIPriority } from "../../miscellaneous/UIPriority";
3
3
  import type { UIRelation } from "../../miscellaneous/UIRelation";
4
- /** Horizontal and vertical values */
5
- export interface UIType2D<T> {
4
+ /** Horizontal and vertical values object */
5
+ export interface UIType2DObject<T> {
6
6
  /** Horizontal value */
7
7
  h?: T;
8
8
  /** Vertical value */
9
9
  v?: T;
10
10
  }
11
+ /** Horizontal and vertical values as object, tuple, or single value */
12
+ export type UIType2D<T> = UIType2DObject<T> | [T, T] | T;
13
+ /**
14
+ * Normalizes UIType2D input to object form.
15
+ * @param value Object, tuple, or single value
16
+ * @returns Normalized object with h and v properties
17
+ */
18
+ export declare function normalizeUIType2D<T>(value: UIType2D<T> | undefined): UIType2DObject<T>;
11
19
  /** Base 2D constraint options */
12
20
  export interface UIConstraint2DOptions {
13
21
  /** Priority for each axis */
@@ -36,6 +44,17 @@ export interface UIConstraintProportion2DOptions extends UIConstraint2DOptions {
36
44
  /** Proportion for each axis */
37
45
  proportion: UIType2D<number>;
38
46
  }
47
+ /** 2D interpolation constraint options */
48
+ export interface UIConstraintInterpolation2DOptions extends UIConstraint2DOptions {
49
+ /** Anchor on element A for each axis */
50
+ anchorA: UIType2D<number>;
51
+ /** Anchor on element B for each axis */
52
+ anchorB: UIType2D<number>;
53
+ /** Anchor on element C for each axis */
54
+ anchorC: UIType2D<number>;
55
+ /** Interpolation factor for each axis */
56
+ t: UIType2D<number>;
57
+ }
39
58
  /** Horizontal and vertical constraint pair */
40
59
  export interface UIConstraint2DResult<TH, TV> {
41
60
  /** Horizontal constraint */
@@ -1,12 +1,14 @@
1
- import { UIHeightConstraint } from "../../constraints/UIHeightConstraint";
2
- import { UIHorizontalDistanceConstraint } from "../../constraints/UIHorizontalDistanceConstraint";
3
- import { UIHorizontalProportionConstraint } from "../../constraints/UIHorizontalProportionConstraint";
4
- import { UIVerticalDistanceConstraint } from "../../constraints/UIVerticalDistanceConstraint";
5
- import { UIVerticalProportionConstraint } from "../../constraints/UIVerticalProportionConstraint";
6
- import { UIWidthConstraint } from "../../constraints/UIWidthConstraint";
7
1
  import type { UIElement } from "../../elements/UIElement/UIElement";
8
- import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/asserts";
9
- import type { UIConstraint2DResult, UIConstraintDistance2DOptions, UIConstraintProportion2DOptions, UIConstraintSize2DOptions } from "./UIConstraint2DBuilder.Internal";
2
+ import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
3
+ import { UIHeightConstraint } from "../UIHeightConstraint/UIHeightConstraint";
4
+ import { UIHorizontalDistanceConstraint } from "../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint";
5
+ import { UIHorizontalInterpolationConstraint } from "../UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint";
6
+ import { UIHorizontalProportionConstraint } from "../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint";
7
+ import { UIVerticalDistanceConstraint } from "../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint";
8
+ import { UIVerticalInterpolationConstraint } from "../UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint";
9
+ import { UIVerticalProportionConstraint } from "../UIVerticalProportionConstraint/UIVerticalProportionConstraint";
10
+ import { UIWidthConstraint } from "../UIWidthConstraint/UIWidthConstraint";
11
+ import type { UIConstraint2DResult, UIConstraintDistance2DOptions, UIConstraintInterpolation2DOptions, UIConstraintProportion2DOptions, UIConstraintSize2DOptions } from "./UIConstraint2DBuilder.Internal";
10
12
  /** Builder for paired horizontal and vertical constraints */
11
13
  export declare class UIConstraint2DBuilder {
12
14
  /**
@@ -32,4 +34,13 @@ export declare class UIConstraint2DBuilder {
32
34
  * @returns Horizontal and vertical proportion constraints
33
35
  */
34
36
  static proportion(a: UIPlaneElement, b: UIPlaneElement, options?: Partial<UIConstraintProportion2DOptions>): UIConstraint2DResult<UIHorizontalProportionConstraint, UIVerticalProportionConstraint>;
37
+ /**
38
+ * Creates horizontal and vertical interpolation constraints.
39
+ * @param a First element
40
+ * @param b Second element
41
+ * @param c Element to position between A and B
42
+ * @param options Interpolation configuration for both axes
43
+ * @returns Horizontal and vertical interpolation constraints
44
+ */
45
+ static interpolation(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, c: UIPointElement | UIPlaneElement, options?: Partial<UIConstraintInterpolation2DOptions>): UIConstraint2DResult<UIHorizontalInterpolationConstraint, UIVerticalInterpolationConstraint>;
35
46
  }
@@ -1,9 +1,9 @@
1
- import { UIHorizontalDistanceConstraint } from "../../constraints/UIHorizontalDistanceConstraint";
2
- import { UIHorizontalProportionConstraint } from "../../constraints/UIHorizontalProportionConstraint";
3
- import { UIVerticalDistanceConstraint } from "../../constraints/UIVerticalDistanceConstraint";
4
- import { UIVerticalProportionConstraint } from "../../constraints/UIVerticalProportionConstraint";
5
- import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/asserts";
6
- import { UIAspectConstraint } from "../UIAspectConstraint";
1
+ import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UIAspectConstraint } from "../UIAspectConstraint/UIAspectConstraint";
3
+ import { UIHorizontalDistanceConstraint } from "../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint";
4
+ import { UIHorizontalProportionConstraint } from "../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint";
5
+ import { UIVerticalDistanceConstraint } from "../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint";
6
+ import { UIVerticalProportionConstraint } from "../UIVerticalProportionConstraint/UIVerticalProportionConstraint";
7
7
  import type { UICoverConstraintBuilderOptions } from "./UICoverConstraintBuilder.Internal";
8
8
  /** Builder for cover layout (like CSS object-fit: cover) */
9
9
  export declare class UICoverConstraintBuilder {
@@ -1,9 +1,9 @@
1
- import { UIHorizontalDistanceConstraint } from "../../constraints/UIHorizontalDistanceConstraint";
2
- import { UIHorizontalProportionConstraint } from "../../constraints/UIHorizontalProportionConstraint";
3
- import { UIVerticalDistanceConstraint } from "../../constraints/UIVerticalDistanceConstraint";
4
- import { UIVerticalProportionConstraint } from "../../constraints/UIVerticalProportionConstraint";
5
- import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/asserts";
6
- import { UIAspectConstraint } from "../UIAspectConstraint";
1
+ import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
+ import { UIAspectConstraint } from "../UIAspectConstraint/UIAspectConstraint";
3
+ import { UIHorizontalDistanceConstraint } from "../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint";
4
+ import { UIHorizontalProportionConstraint } from "../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint";
5
+ import { UIVerticalDistanceConstraint } from "../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint";
6
+ import { UIVerticalProportionConstraint } from "../UIVerticalProportionConstraint/UIVerticalProportionConstraint";
7
7
  import type { UIFitConstraintBuilderOptions } from "./UIFitConstraintBuilder.Internal";
8
8
  /** Builder for fit layout (like CSS object-fit: contain) */
9
9
  export declare class UIFitConstraintBuilder {
@@ -1,6 +1,6 @@
1
1
  import { Eventail } from "eventail";
2
- import type { UILayer } from "../../layers/UILayer";
3
- import type { UILayerElement, UIPointElement } from "../../miscellaneous/asserts";
2
+ import type { UILayer } from "../../layers/UILayer/UILayer";
3
+ import type { UILayerElement, UIPointElement } from "../../miscellaneous/shared";
4
4
  import type { UISolverWrapperInterface } from "../../wrappers/UISolverWrapper.Internal";
5
5
  import type { UIAnchorOptions } from "./UIAnchor.Internal";
6
6
  /** Point in 2D space with constraint-based positioning */
@@ -9,16 +9,28 @@ export declare enum UIAnimatedImageEvent {
9
9
  /** Animation stopped and reset */
10
10
  STOPPED = 2
11
11
  }
12
+ /** Animation loop behavior */
13
+ export declare enum UILoopMode {
14
+ /** No looping, stops at boundary frame */
15
+ NONE = 0,
16
+ /** Loops back to opposite frame */
17
+ LOOP = 1,
18
+ /** Reverses direction at boundaries */
19
+ PING_PONG = 2
20
+ }
12
21
  /** Configuration options for UIAnimatedImage */
13
22
  export interface UIAnimatedImageOptions extends UIElementOptions {
14
23
  /** Multiplicative tint */
15
24
  color: UIColorConfig;
16
25
  /** Animation speed in frames per second */
17
26
  frameRate: number;
18
- /** Whether animation repeats after completion */
19
- loop: boolean;
27
+ /** Playback speed multiplier. Can be negative for reverse playback. */
28
+ timeScale: number;
29
+ /** Loop behavior */
30
+ loopMode: UILoopMode;
20
31
  /** Whether to start playing immediately */
21
32
  playByDefault: boolean;
22
33
  }
23
34
  export declare const ANIMATED_IMAGE_DEFAULT_FRAME_RATE = 24;
24
- export declare const ANIMATED_IMAGE_DEFAULT_LOOP = true;
35
+ export declare const ANIMATED_IMAGE_DEFAULT_TIME_SCALE = 1;
36
+ export declare const ANIMATED_IMAGE_DEFAULT_LOOP_MODE = UILoopMode.LOOP;
@@ -1,17 +1,19 @@
1
1
  import type { WebGLRenderer } from "three";
2
- import type { UILayer } from "../../layers/UILayer";
2
+ import type { UILayer } from "../../layers/UILayer/UILayer";
3
3
  import { UIColor } from "../../miscellaneous/color/UIColor";
4
4
  import { UITextureView } from "../../miscellaneous/texture/UITextureView";
5
5
  import type { UITextureConfig } from "../../miscellaneous/texture/UITextureView.Internal";
6
6
  import { UIElement } from "../UIElement/UIElement";
7
7
  import type { UIAnimatedImageOptions } from "./UIAnimatedImage.Internal";
8
+ import { UILoopMode } from "./UIAnimatedImage.Internal";
8
9
  /** Frame-based texture animation element */
9
10
  export declare class UIAnimatedImage extends UIElement {
10
11
  /** Multiplicative tint. Alpha channel controls opacity. */
11
12
  readonly color: UIColor;
12
13
  private readonly sequenceInternal;
13
14
  private frameRateInternal;
14
- private loopInternal;
15
+ private timeScaleInternal;
16
+ private loopModeInternal;
15
17
  private readonly textureTransform;
16
18
  private isPlaying;
17
19
  private sequenceFrameIndex;
@@ -31,16 +33,20 @@ export declare class UIAnimatedImage extends UIElement {
31
33
  get sequence(): readonly UITextureView[];
32
34
  /** Animation speed in frames per second */
33
35
  get frameRate(): number;
34
- /** Whether animation repeats after completion */
35
- get loop(): boolean;
36
+ /** Playback speed multiplier. Can be negative for reverse playback. */
37
+ get timeScale(): number;
38
+ /** Loop behavior */
39
+ get loopMode(): UILoopMode;
36
40
  /** Total animation duration in seconds */
37
41
  get duration(): number;
38
42
  /** Replaces animation frames. Stops playback. */
39
43
  set sequence(sequence: UITextureConfig[]);
40
44
  /** Animation speed in frames per second */
41
45
  set frameRate(value: number);
42
- /** Whether animation repeats after completion */
43
- set loop(value: boolean);
46
+ /** Playback speed multiplier. Can be negative for reverse playback. */
47
+ set timeScale(value: number);
48
+ /** Loop behavior */
49
+ set loopMode(value: UILoopMode);
44
50
  /** Removes element and frees resources */
45
51
  destroy(): void;
46
52
  /** Starts or resumes animation playback */