laymur 0.16.0 → 0.17.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 (247) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.editorconfig +14 -0
  3. package/CLAUDE.md +181 -0
  4. package/README.md +84 -208
  5. package/assets/logotype.png +0 -0
  6. package/eslint.config.js +111 -0
  7. package/package.json +20 -36
  8. package/rollup.config.js +52 -0
  9. package/{dist/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts → src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts} +3 -2
  10. package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +60 -0
  11. package/src/core/constraints/UIConstraint.ts +20 -0
  12. package/src/core/constraints/UICustomConstraint.ts +62 -0
  13. package/{dist/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts → src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts} +3 -2
  14. package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +52 -0
  15. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +13 -0
  16. package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +139 -0
  17. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +16 -0
  18. package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +189 -0
  19. package/{dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts → src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts} +3 -2
  20. package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +68 -0
  21. package/{dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts → src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts} +9 -8
  22. package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +94 -0
  23. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +13 -0
  24. package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +135 -0
  25. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +16 -0
  26. package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +189 -0
  27. package/{dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts → src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts} +3 -2
  28. package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +68 -0
  29. package/{dist/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts → src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts} +3 -2
  30. package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +52 -0
  31. package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +84 -0
  32. package/src/core/constraints/builders/UIConstraint2DBuilder.ts +168 -0
  33. package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +15 -0
  34. package/src/core/constraints/builders/UICoverConstraintBuilder.ts +84 -0
  35. package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +15 -0
  36. package/src/core/constraints/builders/UIFitConstraintBuilder.ts +84 -0
  37. package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +13 -0
  38. package/src/core/elements/UIAnchor/UIAnchor.ts +70 -0
  39. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +30 -0
  40. package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +355 -0
  41. package/src/core/elements/UIDummy/UIDummy.Internal.ts +33 -0
  42. package/src/core/elements/UIDummy/UIDummy.ts +244 -0
  43. package/{dist/elements/UIElement/UIElement.Internal.d.ts → src/core/elements/UIElement/UIElement.Internal.ts} +7 -5
  44. package/src/core/elements/UIElement/UIElement.ts +127 -0
  45. package/{dist/elements/UIGraphics/UIGraphics.Internal.d.ts → src/core/elements/UIGraphics/UIGraphics.Internal.ts} +7 -5
  46. package/src/core/elements/UIGraphics/UIGraphics.ts +168 -0
  47. package/{dist/elements/UIImage/UIImage.Internal.d.ts → src/core/elements/UIImage/UIImage.Internal.ts} +3 -2
  48. package/src/core/elements/UIImage/UIImage.ts +138 -0
  49. package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +26 -0
  50. package/src/core/elements/UINineSlice/UINineSlice.ts +296 -0
  51. package/src/core/elements/UIProgress/UIProgress.Internal.ts +24 -0
  52. package/src/core/elements/UIProgress/UIProgress.ts +259 -0
  53. package/src/core/elements/UIScene/UIScene.Internal.ts +46 -0
  54. package/src/core/elements/UIScene/UIScene.ts +259 -0
  55. package/{dist/elements/UIText/UIText.Interfaces.d.ts → src/core/elements/UIText/UIText.Interfaces.ts} +21 -16
  56. package/src/core/elements/UIText/UIText.Internal.ts +29 -0
  57. package/src/core/elements/UIText/UIText.Measuring.ts +183 -0
  58. package/src/core/elements/UIText/UIText.Rendering.ts +83 -0
  59. package/src/core/elements/UIText/UIText.ts +376 -0
  60. package/{dist/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts → src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts} +14 -11
  61. package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +233 -0
  62. package/{dist/layers/UILayer/UILayer.Internal.d.ts → src/core/layers/UILayer/UILayer.Internal.ts} +15 -11
  63. package/src/core/layers/UILayer/UILayer.ts +156 -0
  64. package/src/core/miscellaneous/UIExpression.ts +142 -0
  65. package/src/core/miscellaneous/UIMode.ts +29 -0
  66. package/src/core/miscellaneous/UIOrientation.ts +18 -0
  67. package/src/core/miscellaneous/UIPriority.ts +63 -0
  68. package/src/core/miscellaneous/UIRelation.ts +39 -0
  69. package/src/core/miscellaneous/UITransparencyMode.ts +9 -0
  70. package/src/core/miscellaneous/area/UIArea.ts +5 -0
  71. package/src/core/miscellaneous/area/UIAreaCircle.ts +32 -0
  72. package/src/core/miscellaneous/area/UIAreaPolygon.ts +50 -0
  73. package/src/core/miscellaneous/area/UIAreaRectangle.ts +38 -0
  74. package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +78 -0
  75. package/src/core/miscellaneous/asserts.ts +187 -0
  76. package/src/core/miscellaneous/canvas.ts +73 -0
  77. package/src/core/miscellaneous/color/UIColor.Internal.ts +89 -0
  78. package/src/core/miscellaneous/color/UIColor.ts +844 -0
  79. package/src/core/miscellaneous/computeTransform.ts +127 -0
  80. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +235 -0
  81. package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +524 -0
  82. package/{dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts → src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts} +10 -8
  83. package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +448 -0
  84. package/src/core/miscellaneous/generic-plane/shared.ts +323 -0
  85. package/src/core/miscellaneous/insets/UIInsets.Internal.ts +9 -0
  86. package/src/core/miscellaneous/insets/UIInsets.ts +248 -0
  87. package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +24 -0
  88. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +58 -0
  89. package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +52 -0
  90. package/src/core/miscellaneous/math.ts +16 -0
  91. package/src/core/miscellaneous/micro/UIMicro.Internal.ts +33 -0
  92. package/src/core/miscellaneous/micro/UIMicro.ts +222 -0
  93. package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +8 -0
  94. package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +57 -0
  95. package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +65 -0
  96. package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +65 -0
  97. package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +57 -0
  98. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +65 -0
  99. package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +65 -0
  100. package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +11 -0
  101. package/src/core/miscellaneous/shared.ts +73 -0
  102. package/{dist/miscellaneous/text-span/UITextSpan.Internal.d.ts → src/core/miscellaneous/text-span/UITextSpan.Internal.ts} +5 -4
  103. package/src/core/miscellaneous/text-span/UITextSpan.ts +43 -0
  104. package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +52 -0
  105. package/src/core/miscellaneous/text-style/UITextStyle.ts +479 -0
  106. package/src/core/miscellaneous/texture/UITextureView.Internal.ts +55 -0
  107. package/src/core/miscellaneous/texture/UITextureView.ts +308 -0
  108. package/src/core/miscellaneous/webglCapabilities.ts +129 -0
  109. package/src/core/shaders/UIImage.glsl +10 -0
  110. package/src/core/shaders/UINineSlice.glsl +53 -0
  111. package/src/core/shaders/UIProgress.glsl +15 -0
  112. package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +13 -0
  113. package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +12 -0
  114. package/src/core/shaders/glsl.d.ts +27 -0
  115. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +23 -0
  116. package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +124 -0
  117. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +22 -0
  118. package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +101 -0
  119. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +58 -0
  120. package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +605 -0
  121. package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +70 -0
  122. package/src/particles/behaviorModules/UIBehaviorModule.ts +20 -0
  123. package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +173 -0
  124. package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +104 -0
  125. package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +75 -0
  126. package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +115 -0
  127. package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +77 -0
  128. package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +118 -0
  129. package/src/particles/elements/UIEmitter.Internal.ts +22 -0
  130. package/src/particles/elements/UIEmitter.ts +313 -0
  131. package/src/particles/index.ts +18 -0
  132. package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +263 -0
  133. package/src/particles/instancedParticle/UIInstancedParticle.ts +138 -0
  134. package/src/particles/miscellaneous/miscellaneous.ts +115 -0
  135. package/src/particles/renderingModules/UIRenderingColorOverLife.ts +39 -0
  136. package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +49 -0
  137. package/src/particles/renderingModules/UIRenderingModule.ts +17 -0
  138. package/src/particles/renderingModules/UIRenderingTexture.ts +30 -0
  139. package/src/particles/shaders/UIRenderingColorOverLife.glsl +4 -0
  140. package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +6 -0
  141. package/src/particles/shaders/UIRenderingTexture.glsl +4 -0
  142. package/src/particles/spawnModules/UISpawnModule.ts +22 -0
  143. package/src/particles/spawnModules/UISpawnOffset.ts +62 -0
  144. package/src/particles/spawnModules/UISpawnRandomLifetime.ts +68 -0
  145. package/src/particles/spawnModules/UISpawnRandomRotation.ts +60 -0
  146. package/src/particles/spawnModules/UISpawnRandomScale.ts +81 -0
  147. package/src/particles/spawnModules/UISpawnRandomTorque.ts +62 -0
  148. package/src/particles/spawnModules/UISpawnRandomVelocity.ts +92 -0
  149. package/src/particles/spawnModules/UISpawnRectangle.ts +81 -0
  150. package/tsconfig.json +29 -0
  151. package/dist/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +0 -22
  152. package/dist/constraints/UIConstraint.d.ts +0 -12
  153. package/dist/constraints/UICustomConstraint.d.ts +0 -28
  154. package/dist/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +0 -20
  155. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -11
  156. package/dist/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -36
  157. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -14
  158. package/dist/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -44
  159. package/dist/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -22
  160. package/dist/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -43
  161. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -11
  162. package/dist/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -32
  163. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -14
  164. package/dist/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -44
  165. package/dist/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -22
  166. package/dist/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +0 -20
  167. package/dist/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +0 -64
  168. package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +0 -46
  169. package/dist/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +0 -13
  170. package/dist/constraints/builders/UICoverConstraintBuilder.d.ts +0 -29
  171. package/dist/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +0 -13
  172. package/dist/constraints/builders/UIFitConstraintBuilder.d.ts +0 -29
  173. package/dist/elements/UIAnchor/UIAnchor.Internal.d.ts +0 -9
  174. package/dist/elements/UIAnchor/UIAnchor.d.ts +0 -32
  175. package/dist/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -27
  176. package/dist/elements/UIAnimatedImage/UIAnimatedImage.d.ts +0 -77
  177. package/dist/elements/UIDummy/UIDummy.Internal.d.ts +0 -30
  178. package/dist/elements/UIDummy/UIDummy.d.ts +0 -82
  179. package/dist/elements/UIElement/UIElement.d.ts +0 -38
  180. package/dist/elements/UIGraphics/UIGraphics.d.ts +0 -51
  181. package/dist/elements/UIImage/UIImage.d.ts +0 -32
  182. package/dist/elements/UINineSlice/UINineSlice.Internal.d.ts +0 -23
  183. package/dist/elements/UINineSlice/UINineSlice.d.ts +0 -60
  184. package/dist/elements/UIProgress/UIProgress.Internal.d.ts +0 -14
  185. package/dist/elements/UIProgress/UIProgress.d.ts +0 -45
  186. package/dist/elements/UIScene/UIScene.Internal.d.ts +0 -43
  187. package/dist/elements/UIScene/UIScene.d.ts +0 -59
  188. package/dist/elements/UIText/UIText.Internal.d.ts +0 -26
  189. package/dist/elements/UIText/UIText.Measuring.d.ts +0 -50
  190. package/dist/elements/UIText/UIText.Rendering.d.ts +0 -20
  191. package/dist/elements/UIText/UIText.d.ts +0 -71
  192. package/dist/index.js +0 -9246
  193. package/dist/index.js.map +0 -1
  194. package/dist/index.min.js +0 -2
  195. package/dist/index.min.js.map +0 -1
  196. package/dist/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
  197. package/dist/layers/UILayer/UILayer.d.ts +0 -49
  198. package/dist/miscellaneous/UIExpression.d.ts +0 -69
  199. package/dist/miscellaneous/UIMode.d.ts +0 -23
  200. package/dist/miscellaneous/UIOrientation.d.ts +0 -15
  201. package/dist/miscellaneous/UIPriority.d.ts +0 -32
  202. package/dist/miscellaneous/UIRelation.d.ts +0 -23
  203. package/dist/miscellaneous/UITransparencyMode.d.ts +0 -9
  204. package/dist/miscellaneous/area/UIArea.d.ts +0 -3
  205. package/dist/miscellaneous/area/UIAreaCircle.d.ts +0 -15
  206. package/dist/miscellaneous/area/UIAreaPolygon.d.ts +0 -12
  207. package/dist/miscellaneous/area/UIAreaRectangle.d.ts +0 -17
  208. package/dist/miscellaneous/area/UIAreaRoundedRectangle.d.ts +0 -21
  209. package/dist/miscellaneous/asserts.d.ts +0 -43
  210. package/dist/miscellaneous/canvas.d.ts +0 -31
  211. package/dist/miscellaneous/color/UIColor.Internal.d.ts +0 -7
  212. package/dist/miscellaneous/color/UIColor.d.ts +0 -234
  213. package/dist/miscellaneous/computeTransform.d.ts +0 -18
  214. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -19
  215. package/dist/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -1
  216. package/dist/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -1
  217. package/dist/miscellaneous/generic-plane/shared.d.ts +0 -38
  218. package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +0 -11
  219. package/dist/miscellaneous/insets/UIInsets.d.ts +0 -48
  220. package/dist/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +0 -9
  221. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -21
  222. package/dist/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -16
  223. package/dist/miscellaneous/math.d.ts +0 -5
  224. package/dist/miscellaneous/micro/UIMicro.Internal.d.ts +0 -31
  225. package/dist/miscellaneous/micro/UIMicro.d.ts +0 -59
  226. package/dist/miscellaneous/resize-policy/UIResizePolicy.d.ts +0 -3
  227. package/dist/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +0 -22
  228. package/dist/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +0 -22
  229. package/dist/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -22
  230. package/dist/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +0 -22
  231. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -22
  232. package/dist/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -22
  233. package/dist/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +0 -5
  234. package/dist/miscellaneous/shared.d.ts +0 -46
  235. package/dist/miscellaneous/text-span/UITextSpan.d.ts +0 -14
  236. package/dist/miscellaneous/text-style/UITextStyle.Internal.d.ts +0 -48
  237. package/dist/miscellaneous/text-style/UITextStyle.d.ts +0 -85
  238. package/dist/miscellaneous/texture/UITextureView.Internal.d.ts +0 -49
  239. package/dist/miscellaneous/texture/UITextureView.d.ts +0 -67
  240. package/dist/miscellaneous/webglCapabilities.d.ts +0 -2
  241. package/dist/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +0 -17
  242. package/dist/wrappers/UIInputWrapper/UIInputWrapper.d.ts +0 -13
  243. package/dist/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +0 -13
  244. package/dist/wrappers/UISceneWrapper/UISceneWrapper.d.ts +0 -20
  245. package/dist/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +0 -49
  246. package/dist/wrappers/UISolverWrapper/UISolverWrapper.d.ts +0 -215
  247. /package/{dist/index.d.ts → src/core/index.ts} +0 -0
@@ -0,0 +1,81 @@
1
+ import type { InstancedBufferAttribute } from "three";
2
+ import { MathUtils } from "three";
3
+ import { assertValidPositiveNumber } from "../../core/miscellaneous/asserts";
4
+ import {
5
+ BUILTIN_OFFSET_SCALE_X,
6
+ BUILTIN_OFFSET_SCALE_Y,
7
+ resolveAspect,
8
+ resolveUIRangeConfig,
9
+ type UIAspectConfig,
10
+ type UIRange,
11
+ type UIRangeConfig,
12
+ } from "../miscellaneous/miscellaneous";
13
+ import { UISpawnModule } from "./UISpawnModule";
14
+
15
+ /**
16
+ * Assigns random scale to particles.
17
+ *
18
+ * Base scale is chosen uniformly from the range. Aspect ratio is applied to X scale.
19
+ */
20
+ export class UISpawnRandomScale extends UISpawnModule<{ builtin: "Matrix4" }> {
21
+ /** @internal */
22
+ public requiredProperties = { builtin: "Matrix4" } as const;
23
+ private scaleInternal: UIRange;
24
+ private aspectInternal: number;
25
+
26
+ /**
27
+ * @param scale - Base scale range. Accepts number, tuple, or range object
28
+ * @param aspect - Width/height ratio. Accepts number or texture
29
+ */
30
+ constructor(scale: UIRangeConfig = { min: 50, max: 100 }, aspect: UIAspectConfig = 1) {
31
+ super();
32
+ this.scaleInternal = resolveUIRangeConfig(scale);
33
+ this.aspectInternal = resolveAspect(aspect);
34
+ assertValidPositiveNumber(this.scaleInternal.min, "UISpawnRandomScale.constructor.scale.min");
35
+ assertValidPositiveNumber(this.scaleInternal.max, "UISpawnRandomScale.constructor.scale.max");
36
+ assertValidPositiveNumber(this.aspectInternal, "UISpawnRandomScale.constructor.aspect");
37
+ }
38
+
39
+ /** Base scale range */
40
+ public get scale(): UIRange {
41
+ return this.scaleInternal;
42
+ }
43
+
44
+ /** Width/height aspect ratio */
45
+ public get aspect(): number {
46
+ return this.aspectInternal;
47
+ }
48
+
49
+ /** Base scale range */
50
+ public set scale(value: UIRangeConfig) {
51
+ this.scaleInternal = resolveUIRangeConfig(value);
52
+ assertValidPositiveNumber(this.scaleInternal.min, "UISpawnRandomScale.scale.min");
53
+ assertValidPositiveNumber(this.scaleInternal.max, "UISpawnRandomScale.scale.max");
54
+ }
55
+
56
+ /** Width/height aspect ratio */
57
+ public set aspect(value: UIAspectConfig) {
58
+ this.aspectInternal = resolveAspect(value);
59
+ assertValidPositiveNumber(this.aspectInternal, "UISpawnRandomScale.aspect");
60
+ }
61
+
62
+ /** @internal */
63
+ public spawn(
64
+ properties: { builtin: InstancedBufferAttribute },
65
+ instanceBegin: number,
66
+ instanceEnd: number,
67
+ ): void {
68
+ const { builtin } = properties;
69
+ const { array, itemSize } = builtin;
70
+ const { min: scaleMin, max: scaleMax } = this.scaleInternal;
71
+
72
+ for (let i = instanceBegin; i < instanceEnd; i++) {
73
+ const itemOffset = i * itemSize;
74
+ const randomScale = MathUtils.randFloat(scaleMin, scaleMax);
75
+ array[itemOffset + BUILTIN_OFFSET_SCALE_X] = randomScale * this.aspectInternal;
76
+ array[itemOffset + BUILTIN_OFFSET_SCALE_Y] = randomScale;
77
+ }
78
+
79
+ builtin.needsUpdate = true;
80
+ }
81
+ }
@@ -0,0 +1,62 @@
1
+ import type { InstancedBufferAttribute } from "three";
2
+ import { MathUtils } from "three";
3
+ import { assertValidNumber } from "../../core/miscellaneous/asserts";
4
+ import {
5
+ BUILTIN_OFFSET_TORQUE,
6
+ resolveUIRangeConfig,
7
+ type UIRange,
8
+ type UIRangeConfig,
9
+ } from "../miscellaneous/miscellaneous";
10
+ import { UISpawnModule } from "./UISpawnModule";
11
+
12
+ /**
13
+ * Assigns random angular velocity to particles.
14
+ *
15
+ * Torque (rotation speed) is chosen uniformly from the specified range.
16
+ */
17
+ export class UISpawnRandomTorque extends UISpawnModule<{
18
+ builtin: "Matrix4";
19
+ }> {
20
+ /** @internal */
21
+ public readonly requiredProperties = { builtin: "Matrix4" } as const;
22
+ private torqueInternal: UIRange;
23
+
24
+ /**
25
+ * @param torque - Angular velocity range in radians/second. Accepts number, tuple, or range object
26
+ */
27
+ constructor(torque: UIRangeConfig = { min: -Math.PI, max: Math.PI }) {
28
+ super();
29
+ this.torqueInternal = resolveUIRangeConfig(torque);
30
+ assertValidNumber(this.torqueInternal.min, "UISpawnRandomTorque.constructor.torque.min");
31
+ assertValidNumber(this.torqueInternal.max, "UISpawnRandomTorque.constructor.torque.max");
32
+ }
33
+
34
+ /** Angular velocity range in radians/second */
35
+ public get torque(): UIRange {
36
+ return this.torqueInternal;
37
+ }
38
+
39
+ /** Angular velocity range in radians/second */
40
+ public set torque(value: UIRangeConfig) {
41
+ this.torqueInternal = resolveUIRangeConfig(value);
42
+ assertValidNumber(this.torqueInternal.min, "UISpawnRandomTorque.torque.min");
43
+ assertValidNumber(this.torqueInternal.max, "UISpawnRandomTorque.torque.max");
44
+ }
45
+
46
+ /** @internal */
47
+ public spawn(
48
+ properties: { builtin: InstancedBufferAttribute },
49
+ instanceBegin: number,
50
+ instanceEnd: number,
51
+ ): void {
52
+ const { builtin } = properties;
53
+ const { array, itemSize } = builtin;
54
+ const { min: torqueMin, max: torqueMax } = this.torqueInternal;
55
+
56
+ for (let i = instanceBegin; i < instanceEnd; i++) {
57
+ array[i * itemSize + BUILTIN_OFFSET_TORQUE] = MathUtils.randFloat(torqueMin, torqueMax);
58
+ }
59
+
60
+ builtin.needsUpdate = true;
61
+ }
62
+ }
@@ -0,0 +1,92 @@
1
+ import type { InstancedBufferAttribute } from "three";
2
+ import { MathUtils } from "three";
3
+ import { assertValidNumber } from "../../core/miscellaneous/asserts";
4
+ import {
5
+ BUILTIN_OFFSET_VELOCITY_X,
6
+ BUILTIN_OFFSET_VELOCITY_Y,
7
+ resolveUIRangeConfig,
8
+ type UIRange,
9
+ type UIRangeConfig,
10
+ } from "../miscellaneous/miscellaneous";
11
+ import { UISpawnModule } from "./UISpawnModule";
12
+
13
+ /**
14
+ * Assigns random velocity to particles.
15
+ *
16
+ * Direction and magnitude are chosen independently from their respective ranges.
17
+ */
18
+ export class UISpawnRandomVelocity extends UISpawnModule<{ builtin: "Matrix4" }> {
19
+ /** @internal */
20
+ public readonly requiredProperties = { builtin: "Matrix4" } as const;
21
+ private angleInternal: UIRange;
22
+ private magnitudeInternal: UIRange;
23
+
24
+ /**
25
+ * @param angle - Direction range in radians. Accepts number, tuple, or range object
26
+ * @param magnitude - Speed range in units/second. Accepts number, tuple, or range object
27
+ */
28
+ constructor(
29
+ angle: UIRangeConfig = { min: -Math.PI, max: Math.PI },
30
+ magnitude: UIRangeConfig = { min: -50, max: 50 },
31
+ ) {
32
+ super();
33
+ this.angleInternal = resolveUIRangeConfig(angle);
34
+ this.magnitudeInternal = resolveUIRangeConfig(magnitude);
35
+ assertValidNumber(this.angleInternal.min, "UISpawnRandomVelocity.constructor.angle.min");
36
+ assertValidNumber(this.angleInternal.max, "UISpawnRandomVelocity.constructor.angle.max");
37
+ assertValidNumber(
38
+ this.magnitudeInternal.min,
39
+ "UISpawnRandomVelocity.constructor.magnitude.min",
40
+ );
41
+ assertValidNumber(
42
+ this.magnitudeInternal.max,
43
+ "UISpawnRandomVelocity.constructor.magnitude.max",
44
+ );
45
+ }
46
+
47
+ /** Direction range in radians */
48
+ public get angle(): UIRange {
49
+ return this.angleInternal;
50
+ }
51
+
52
+ /** Speed range in units/second */
53
+ public get magnitude(): UIRange {
54
+ return this.magnitudeInternal;
55
+ }
56
+
57
+ /** Direction range in radians */
58
+ public set angle(value: UIRangeConfig) {
59
+ this.angleInternal = resolveUIRangeConfig(value);
60
+ assertValidNumber(this.angleInternal.min, "UISpawnRandomVelocity.angle.min");
61
+ assertValidNumber(this.angleInternal.max, "UISpawnRandomVelocity.angle.max");
62
+ }
63
+
64
+ /** Speed range in units/second */
65
+ public set magnitude(value: UIRangeConfig) {
66
+ this.magnitudeInternal = resolveUIRangeConfig(value);
67
+ assertValidNumber(this.magnitudeInternal.min, "UISpawnRandomVelocity.magnitude.min");
68
+ assertValidNumber(this.magnitudeInternal.max, "UISpawnRandomVelocity.magnitude.max");
69
+ }
70
+
71
+ /** @internal */
72
+ public spawn(
73
+ properties: { builtin: InstancedBufferAttribute },
74
+ instanceBegin: number,
75
+ instanceEnd: number,
76
+ ): void {
77
+ const { builtin } = properties;
78
+ const { array, itemSize } = builtin;
79
+ const { min: angleMin, max: angleMax } = this.angleInternal;
80
+ const { min: magnitudeMin, max: magnitudeMax } = this.magnitudeInternal;
81
+
82
+ for (let i = instanceBegin; i < instanceEnd; i++) {
83
+ const itemOffset = i * itemSize;
84
+ const angle = MathUtils.randFloat(angleMin, angleMax);
85
+ const magnitude = MathUtils.randFloat(magnitudeMin, magnitudeMax);
86
+ array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] = Math.cos(angle) * magnitude;
87
+ array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] = Math.sin(angle) * magnitude;
88
+ }
89
+
90
+ builtin.needsUpdate = true;
91
+ }
92
+ }
@@ -0,0 +1,81 @@
1
+ import type { InstancedBufferAttribute } from "three";
2
+ import { MathUtils } from "three";
3
+ import { assertValidNumber } from "../../core/miscellaneous/asserts";
4
+ import type { Vector2Like } from "../../core/miscellaneous/math";
5
+ import {
6
+ BUILTIN_OFFSET_POSITION_X,
7
+ BUILTIN_OFFSET_POSITION_Y,
8
+ resolveUIVector2Config,
9
+ type UIVector2Config,
10
+ } from "../miscellaneous/miscellaneous";
11
+ import { UISpawnModule } from "./UISpawnModule";
12
+
13
+ /**
14
+ * Spawns particles at random positions within a rectangle.
15
+ *
16
+ * Position is chosen uniformly within the bounds defined by min and max.
17
+ */
18
+ export class UISpawnRectangle extends UISpawnModule<{ builtin: "Matrix4" }> {
19
+ /** @internal */
20
+ public readonly requiredProperties = { builtin: "Matrix4" } as const;
21
+ private minInternal: Vector2Like;
22
+ private maxInternal: Vector2Like;
23
+
24
+ /**
25
+ * @param min - Bottom-left corner of spawn area
26
+ * @param max - Top-right corner of spawn area
27
+ */
28
+ constructor(min: UIVector2Config = { x: -50, y: -50 }, max: UIVector2Config = { x: 50, y: 50 }) {
29
+ super();
30
+ this.minInternal = resolveUIVector2Config(min);
31
+ this.maxInternal = resolveUIVector2Config(max);
32
+ assertValidNumber(this.minInternal.x, "UISpawnRectangle.constructor.min.x");
33
+ assertValidNumber(this.minInternal.y, "UISpawnRectangle.constructor.min.y");
34
+ assertValidNumber(this.maxInternal.x, "UISpawnRectangle.constructor.max.x");
35
+ assertValidNumber(this.maxInternal.y, "UISpawnRectangle.constructor.max.y");
36
+ }
37
+
38
+ /** Bottom-left corner of spawn area */
39
+ public get min(): Vector2Like {
40
+ return this.minInternal;
41
+ }
42
+
43
+ /** Top-right corner of spawn area */
44
+ public get max(): Vector2Like {
45
+ return this.maxInternal;
46
+ }
47
+
48
+ /** Bottom-left corner of spawn area */
49
+ public set min(value: UIVector2Config) {
50
+ this.minInternal = resolveUIVector2Config(value);
51
+ assertValidNumber(this.minInternal.x, "UISpawnRectangle.min.x");
52
+ assertValidNumber(this.minInternal.y, "UISpawnRectangle.min.y");
53
+ }
54
+
55
+ /** Top-right corner of spawn area */
56
+ public set max(value: UIVector2Config) {
57
+ this.maxInternal = resolveUIVector2Config(value);
58
+ assertValidNumber(this.maxInternal.x, "UISpawnRectangle.max.x");
59
+ assertValidNumber(this.maxInternal.y, "UISpawnRectangle.max.y");
60
+ }
61
+
62
+ /** @internal */
63
+ public spawn(
64
+ properties: { builtin: InstancedBufferAttribute },
65
+ instanceBegin: number,
66
+ instanceEnd: number,
67
+ ): void {
68
+ const { builtin } = properties;
69
+ const { array, itemSize } = builtin;
70
+ const { x: minX, y: minY } = this.minInternal;
71
+ const { x: maxX, y: maxY } = this.maxInternal;
72
+
73
+ for (let i = instanceBegin; i < instanceEnd; i++) {
74
+ const itemOffset = i * itemSize;
75
+ array[itemOffset + BUILTIN_OFFSET_POSITION_X] = MathUtils.randFloat(minX, maxX);
76
+ array[itemOffset + BUILTIN_OFFSET_POSITION_Y] = MathUtils.randFloat(minY, maxY);
77
+ }
78
+
79
+ builtin.needsUpdate = true;
80
+ }
81
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["ES2020", "DOM"],
4
+ "target": "ES2020",
5
+ "module": "ES2020",
6
+ "moduleResolution": "bundler",
7
+ "useDefineForClassFields": false,
8
+ "downlevelIteration": true,
9
+ "strict": true,
10
+ "noImplicitAny": true,
11
+ "strictNullChecks": true,
12
+ "strictFunctionTypes": true,
13
+ "strictBindCallApply": true,
14
+ "noImplicitThis": true,
15
+ "noImplicitOverride": true,
16
+ "alwaysStrict": true,
17
+ "esModuleInterop": true,
18
+ "forceConsistentCasingInFileNames": true,
19
+ "skipLibCheck": false,
20
+ "verbatimModuleSyntax": true,
21
+ "declaration": true,
22
+ "declarationDir": "./dist",
23
+ "emitDeclarationOnly": false,
24
+ "outDir": "./dist",
25
+ "sourceMap": true,
26
+ "stripInternal": true
27
+ },
28
+ "include": ["src/**/*"]
29
+ }
@@ -1,22 +0,0 @@
1
- import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
- import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
- import type { UIAspectConstraintOptions } from "./UIAspectConstraint.Internal";
4
- /** Maintains element aspect ratio (width = height * aspect) */
5
- export declare class UIAspectConstraint extends UISingleParameterConstraint {
6
- private readonly element;
7
- /** Solver constraint descriptor */
8
- protected readonly constraint: number;
9
- /** Current aspect ratio */
10
- private aspectInternal;
11
- /**
12
- * @param element Element to constrain
13
- * @param options Aspect configuration. Defaults to element's current ratio.
14
- */
15
- constructor(element: UIPlaneElement & UILayerElement, options?: Partial<UIAspectConstraintOptions>);
16
- /** Current aspect ratio (width/height) */
17
- get aspect(): number;
18
- /** Updates aspect ratio */
19
- set aspect(value: number);
20
- /** Builds constraint expression: width - (height * aspect) = 0 */
21
- private buildLHS;
22
- }
@@ -1,12 +0,0 @@
1
- import type { UILayer } from "../layers/UILayer/UILayer";
2
- import type { UISolverWrapperInterface } from "../wrappers/UISolverWrapper/UISolverWrapper.Internal";
3
- /** Base class for layout constraints */
4
- export declare abstract class UIConstraint {
5
- readonly layer: UILayer;
6
- /** Optional constraint name */
7
- name: string;
8
- /** Constraint solver wrapper */
9
- protected readonly solverWrapper: UISolverWrapperInterface;
10
- /** @param layer Layer containing this constraint */
11
- constructor(layer: UILayer, name?: string);
12
- }
@@ -1,28 +0,0 @@
1
- import type { UILayer } from "../layers/UILayer/UILayer";
2
- import type { UIExpression } from "../miscellaneous/UIExpression";
3
- import { UISingleParameterConstraint } from "./UISingleParameterConstraint/UISingleParameterConstraint";
4
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint/UISingleParameterConstraint.Internal";
5
- /** Constraint with custom LHS and RHS expressions */
6
- export declare class UICustomConstraint extends UISingleParameterConstraint {
7
- /** Solver constraint descriptor */
8
- protected readonly constraint: number;
9
- /** Left-hand side expression */
10
- private lhsInternal;
11
- /** Right-hand side expression */
12
- private rhsInternal;
13
- /**
14
- * @param layer Layer containing this constraint
15
- * @param lhs Left-hand side expression
16
- * @param rhs Right-hand side expression
17
- * @param options Constraint configuration
18
- */
19
- constructor(layer: UILayer, lhs: UIExpression, rhs: UIExpression, options?: Partial<UISingleParameterConstraintOptions>);
20
- /** Left-hand side expression */
21
- get lhs(): UIExpression;
22
- /** Right-hand side expression */
23
- get rhs(): UIExpression;
24
- /** Updates left-hand side expression */
25
- setLHS(value: UIExpression): void;
26
- /** Updates right-hand side expression */
27
- setRHS(value: UIExpression): void;
28
- }
@@ -1,20 +0,0 @@
1
- import type { UILayerElement, UIPlaneElement } from "../../miscellaneous/shared";
2
- import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
- import type { UIHeightConstraintOptions } from "./UIHeightConstraint.Internal";
4
- /** Fixes element height to constant value */
5
- export declare class UIHeightConstraint extends UISingleParameterConstraint {
6
- private readonly element;
7
- /** Solver constraint descriptor */
8
- protected readonly constraint: number;
9
- /** Current height value */
10
- private heightInternal;
11
- /**
12
- * @param element Element to constrain
13
- * @param options Height configuration. Defaults to element's current height.
14
- */
15
- constructor(element: UIPlaneElement & UILayerElement, options?: Partial<UIHeightConstraintOptions>);
16
- /** Current height in world units */
17
- get height(): number;
18
- /** Updates height */
19
- set height(value: number);
20
- }
@@ -1,11 +0,0 @@
1
- import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
- export declare const DEFAULT_ANCHOR = 0.5;
3
- /** Horizontal distance constraint options */
4
- export interface UIHorizontalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
5
- /** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
6
- anchorA: number;
7
- /** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
8
- anchorB: number;
9
- /** Distance in world units */
10
- distance: number;
11
- }
@@ -1,36 +0,0 @@
1
- import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
2
- import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
- import type { UIHorizontalDistanceConstraintOptions } from "./UIHorizontalDistanceConstraint.Internal";
4
- /** Maintains horizontal distance between elements with configurable anchors */
5
- export declare class UIHorizontalDistanceConstraint extends UISingleParameterConstraint {
6
- private readonly a;
7
- private readonly b;
8
- /** Solver constraint descriptor */
9
- protected readonly constraint: number;
10
- /** Anchor on element A */
11
- private anchorAInternal;
12
- /** Anchor on element B */
13
- private anchorBInternal;
14
- /** Current distance */
15
- private distanceInternal;
16
- /**
17
- * @param a First element
18
- * @param b Second element
19
- * @param options Distance configuration
20
- */
21
- constructor(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, options?: Partial<UIHorizontalDistanceConstraintOptions>);
22
- /** Current distance in world units */
23
- get distance(): number;
24
- /** Anchor on element A (0 = left, 0.5 = center, 1 = right) */
25
- get anchorA(): number;
26
- /** Anchor on element B (0 = left, 0.5 = center, 1 = right) */
27
- get anchorB(): number;
28
- /** Updates distance */
29
- set distance(value: number);
30
- /** Updates anchor on element A */
31
- set anchorA(value: number);
32
- /** Updates anchor on element B */
33
- set anchorB(value: number);
34
- /** Builds constraint expression for distance between anchored positions */
35
- private buildLHS;
36
- }
@@ -1,14 +0,0 @@
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
- }
@@ -1,44 +0,0 @@
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,22 +0,0 @@
1
- import type { UIPlaneElement } from "../../miscellaneous/shared";
2
- import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
- import type { UIHorizontalProportionConstraintOptions } from "./UIHorizontalProportionConstraint.Internal";
4
- /** Maintains proportional width relationship (A.width * proportion = B.width) */
5
- export declare class UIHorizontalProportionConstraint extends UISingleParameterConstraint {
6
- private readonly a;
7
- private readonly b;
8
- protected readonly constraint: number;
9
- private proportionInternal;
10
- /**
11
- * @param a First element
12
- * @param b Second element
13
- * @param options Proportion configuration
14
- */
15
- constructor(a: UIPlaneElement, b: UIPlaneElement, options?: Partial<UIHorizontalProportionConstraintOptions>);
16
- /** Current proportion multiplier */
17
- get proportion(): number;
18
- /** Updates proportion multiplier */
19
- set proportion(value: number);
20
- /** Builds constraint expression for proportional relationship */
21
- private buildRHS;
22
- }
@@ -1,43 +0,0 @@
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
- import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint.Internal";
7
- /** Base class for constraints with priority, relation, and orientation */
8
- export declare abstract class UISingleParameterConstraint extends UIConstraint {
9
- /** Constraint priority */
10
- private priorityInternal;
11
- /** Constraint relation */
12
- private relationInternal;
13
- /** Constraint orientation */
14
- private orientationInternal;
15
- /** Solver constraint descriptor */
16
- protected abstract readonly constraint: number;
17
- /**
18
- * @param layer Layer containing this constraint
19
- * @param options Constraint configuration
20
- */
21
- constructor(layer: UILayer, options?: Partial<UISingleParameterConstraintOptions>);
22
- /** Constraint priority */
23
- get priority(): UIPriority;
24
- /** Constraint relation */
25
- get relation(): UIRelation;
26
- /** When constraint is active */
27
- get orientation(): UIOrientation;
28
- /** Updates constraint priority */
29
- set priority(value: UIPriority);
30
- /** Updates constraint relation */
31
- set relation(value: UIRelation);
32
- /** Updates when constraint is active */
33
- set orientation(value: UIOrientation);
34
- /** Removes constraint from solver and cleans up listeners */
35
- destroy(): void;
36
- /**
37
- * Checks if constraint should be active for current orientation.
38
- * @returns True if orientation is ALWAYS or matches layer orientation
39
- */
40
- protected isConstraintEnabled(): boolean;
41
- /** Updates constraint enabled state when layer orientation changes */
42
- private readonly onOrientationChange;
43
- }
@@ -1,11 +0,0 @@
1
- import type { UISingleParameterConstraintOptions } from "../UISingleParameterConstraint/UISingleParameterConstraint.Internal";
2
- export declare const DEFAULT_ANCHOR = 0.5;
3
- /** Vertical distance constraint options */
4
- export interface UIVerticalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
5
- /** Anchor on element A (0 = bottom, 0.5 = center, 1 = top) */
6
- anchorA: number;
7
- /** Anchor on element B (0 = bottom, 0.5 = center, 1 = top) */
8
- anchorB: number;
9
- /** Distance in world units */
10
- distance: number;
11
- }
@@ -1,32 +0,0 @@
1
- import type { UIPlaneElement, UIPointElement } from "../../miscellaneous/shared";
2
- import { UISingleParameterConstraint } from "../UISingleParameterConstraint/UISingleParameterConstraint";
3
- import type { UIVerticalDistanceConstraintOptions } from "./UIVerticalDistanceConstraint.Internal";
4
- /** Maintains vertical distance between elements with configurable anchors */
5
- export declare class UIVerticalDistanceConstraint extends UISingleParameterConstraint {
6
- private readonly a;
7
- private readonly b;
8
- protected readonly constraint: number;
9
- private anchorAInternal;
10
- private anchorBInternal;
11
- private distanceInternal;
12
- /**
13
- * @param a First element
14
- * @param b Second element
15
- * @param options Distance configuration
16
- */
17
- constructor(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, options?: Partial<UIVerticalDistanceConstraintOptions>);
18
- /** Current distance in world units */
19
- get distance(): number;
20
- /** Anchor on element A (0 = bottom, 0.5 = center, 1 = top) */
21
- get anchorA(): number;
22
- /** Anchor on element B (0 = bottom, 0.5 = center, 1 = top) */
23
- get anchorB(): number;
24
- /** Updates distance */
25
- set distance(value: number);
26
- /** Updates anchor on element A */
27
- set anchorA(value: number);
28
- /** Updates anchor on element B */
29
- set anchorB(value: number);
30
- /** Builds constraint expression for distance between anchored positions */
31
- private buildLHS;
32
- }