laymur 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -208
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/{constraints → core/constraints}/UIConstraint.d.ts +2 -2
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.Internal.d.ts +3 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIAnchor/UIAnchor.d.ts +3 -3
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/{elements → core/elements}/UIDummy/UIDummy.d.ts +2 -2
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/{elements → core/elements}/UIElement/UIElement.d.ts +2 -2
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/{miscellaneous → core/miscellaneous}/math.d.ts +2 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.js +103 -0
- package/dist/core/shaders/UIImage.glsl.js +3 -0
- package/dist/core/shaders/UINineSlice.glsl.js +3 -0
- package/dist/core/shaders/UIProgress.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.d.ts +2 -2
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.Internal.d.ts +1 -1
- package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.d.ts +2 -2
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -9246
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
- package/dist/particles/elements/UIEmitter.Internal.js +11 -0
- package/dist/particles/elements/UIEmitter.d.ts +68 -0
- package/dist/particles/elements/UIEmitter.js +203 -0
- package/dist/particles/index.d.ts +18 -0
- package/dist/particles/index.js +18 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
- package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
- package/dist/particles/miscellaneous/miscellaneous.js +67 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
- package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
- package/dist/particles/spawnModules/UISpawnModule.js +9 -0
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
- package/package.json +27 -36
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UICustomConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.Internal.d.ts +0 -0
- /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIDummy/UIDummy.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIElement/UIElement.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIImage/UIImage.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIProgress/UIProgress.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIScene/UIScene.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Interfaces.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Internal.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Measuring.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.Rendering.d.ts +0 -0
- /package/dist/{elements → core/elements}/UIText/UIText.d.ts +0 -0
- /package/dist/{index.d.ts → core/index.d.ts} +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.Internal.d.ts +0 -0
- /package/dist/{layers → core/layers}/UILayer/UILayer.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIExpression.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIOrientation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIPriority.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UIRelation.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/UITransparencyMode.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIArea.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaCircle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaPolygon.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRoundedRectangle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/asserts.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/canvas.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/computeTransform.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunction.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicy.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCover.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCross.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFit.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyNone.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/shared.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.Internal.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.d.ts +0 -0
- /package/dist/{miscellaneous → core/miscellaneous}/webglCapabilities.d.ts +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { UIHeightConstraint } from '../UIHeightConstraint/UIHeightConstraint.js';
|
|
2
|
+
import { UIHorizontalDistanceConstraint } from '../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js';
|
|
3
|
+
import { UIHorizontalInterpolationConstraint } from '../UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js';
|
|
4
|
+
import { UIHorizontalProportionConstraint } from '../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js';
|
|
5
|
+
import { UIVerticalDistanceConstraint } from '../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js';
|
|
6
|
+
import { UIVerticalInterpolationConstraint } from '../UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js';
|
|
7
|
+
import { UIVerticalProportionConstraint } from '../UIVerticalProportionConstraint/UIVerticalProportionConstraint.js';
|
|
8
|
+
import { UIWidthConstraint } from '../UIWidthConstraint/UIWidthConstraint.js';
|
|
9
|
+
import { normalizeUIType2D } from './UIConstraint2DBuilder.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Builder for paired horizontal and vertical constraints */
|
|
12
|
+
class UIConstraint2DBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Creates width and height constraints.
|
|
15
|
+
* @param element Element to constrain
|
|
16
|
+
* @param options Size configuration for both axes
|
|
17
|
+
* @returns Width and height constraints
|
|
18
|
+
*/
|
|
19
|
+
static size(element, options = {}) {
|
|
20
|
+
const size = normalizeUIType2D(options.size);
|
|
21
|
+
const priority = normalizeUIType2D(options.priority);
|
|
22
|
+
const relation = normalizeUIType2D(options.relation);
|
|
23
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
24
|
+
return {
|
|
25
|
+
h: new UIWidthConstraint(element, {
|
|
26
|
+
width: size.h,
|
|
27
|
+
priority: priority.h,
|
|
28
|
+
relation: relation.h,
|
|
29
|
+
orientation: orientation.h,
|
|
30
|
+
}),
|
|
31
|
+
v: new UIHeightConstraint(element, {
|
|
32
|
+
height: size.v,
|
|
33
|
+
priority: priority.v,
|
|
34
|
+
relation: relation.v,
|
|
35
|
+
orientation: orientation.v,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates horizontal and vertical distance constraints.
|
|
41
|
+
* @param a First element
|
|
42
|
+
* @param b Second element
|
|
43
|
+
* @param options Distance configuration for both axes
|
|
44
|
+
* @returns Horizontal and vertical distance constraints
|
|
45
|
+
*/
|
|
46
|
+
static distance(a, b, options = {}) {
|
|
47
|
+
const anchorA = normalizeUIType2D(options.anchorA);
|
|
48
|
+
const anchorB = normalizeUIType2D(options.anchorB);
|
|
49
|
+
const distance = normalizeUIType2D(options.distance);
|
|
50
|
+
const priority = normalizeUIType2D(options.priority);
|
|
51
|
+
const relation = normalizeUIType2D(options.relation);
|
|
52
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
53
|
+
return {
|
|
54
|
+
h: new UIHorizontalDistanceConstraint(a, b, {
|
|
55
|
+
anchorA: anchorA.h,
|
|
56
|
+
anchorB: anchorB.h,
|
|
57
|
+
distance: distance.h,
|
|
58
|
+
priority: priority.h,
|
|
59
|
+
relation: relation.h,
|
|
60
|
+
orientation: orientation.h,
|
|
61
|
+
}),
|
|
62
|
+
v: new UIVerticalDistanceConstraint(a, b, {
|
|
63
|
+
anchorA: anchorA.v,
|
|
64
|
+
anchorB: anchorB.v,
|
|
65
|
+
distance: distance.v,
|
|
66
|
+
priority: priority.v,
|
|
67
|
+
relation: relation.v,
|
|
68
|
+
orientation: orientation.v,
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates horizontal and vertical proportion constraints.
|
|
74
|
+
* @param a Element with proportional dimensions
|
|
75
|
+
* @param b Target element
|
|
76
|
+
* @param options Proportion configuration for both axes
|
|
77
|
+
* @returns Horizontal and vertical proportion constraints
|
|
78
|
+
*/
|
|
79
|
+
static proportion(a, b, options = {}) {
|
|
80
|
+
const proportion = normalizeUIType2D(options.proportion);
|
|
81
|
+
const priority = normalizeUIType2D(options.priority);
|
|
82
|
+
const relation = normalizeUIType2D(options.relation);
|
|
83
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
84
|
+
return {
|
|
85
|
+
h: new UIHorizontalProportionConstraint(a, b, {
|
|
86
|
+
proportion: proportion.h,
|
|
87
|
+
priority: priority.h,
|
|
88
|
+
relation: relation.h,
|
|
89
|
+
orientation: orientation.h,
|
|
90
|
+
}),
|
|
91
|
+
v: new UIVerticalProportionConstraint(a, b, {
|
|
92
|
+
proportion: proportion.v,
|
|
93
|
+
priority: priority.v,
|
|
94
|
+
relation: relation.v,
|
|
95
|
+
orientation: orientation.v,
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates horizontal and vertical interpolation constraints.
|
|
101
|
+
* @param a First element
|
|
102
|
+
* @param b Second element
|
|
103
|
+
* @param c Element to position between A and B
|
|
104
|
+
* @param options Interpolation configuration for both axes
|
|
105
|
+
* @returns Horizontal and vertical interpolation constraints
|
|
106
|
+
*/
|
|
107
|
+
static interpolation(a, b, c, options = {}) {
|
|
108
|
+
const anchorA = normalizeUIType2D(options.anchorA);
|
|
109
|
+
const anchorB = normalizeUIType2D(options.anchorB);
|
|
110
|
+
const anchorC = normalizeUIType2D(options.anchorC);
|
|
111
|
+
const t = normalizeUIType2D(options.t);
|
|
112
|
+
const priority = normalizeUIType2D(options.priority);
|
|
113
|
+
const relation = normalizeUIType2D(options.relation);
|
|
114
|
+
const orientation = normalizeUIType2D(options.orientation);
|
|
115
|
+
return {
|
|
116
|
+
h: new UIHorizontalInterpolationConstraint(a, b, c, {
|
|
117
|
+
anchorA: anchorA.h,
|
|
118
|
+
anchorB: anchorB.h,
|
|
119
|
+
anchorC: anchorC.h,
|
|
120
|
+
t: t.h,
|
|
121
|
+
priority: priority.h,
|
|
122
|
+
relation: relation.h,
|
|
123
|
+
orientation: orientation.h,
|
|
124
|
+
}),
|
|
125
|
+
v: new UIVerticalInterpolationConstraint(a, b, c, {
|
|
126
|
+
anchorA: anchorA.v,
|
|
127
|
+
anchorB: anchorB.v,
|
|
128
|
+
anchorC: anchorC.v,
|
|
129
|
+
t: t.v,
|
|
130
|
+
priority: priority.v,
|
|
131
|
+
relation: relation.v,
|
|
132
|
+
orientation: orientation.v,
|
|
133
|
+
}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { UIConstraint2DBuilder };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { UIRelation } from '../../miscellaneous/UIRelation.js';
|
|
4
|
+
import { UIAspectConstraint } from '../UIAspectConstraint/UIAspectConstraint.js';
|
|
5
|
+
import { UIHorizontalDistanceConstraint } from '../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js';
|
|
6
|
+
import { UIHorizontalProportionConstraint } from '../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js';
|
|
7
|
+
import { UIVerticalDistanceConstraint } from '../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js';
|
|
8
|
+
import { UIVerticalProportionConstraint } from '../UIVerticalProportionConstraint/UIVerticalProportionConstraint.js';
|
|
9
|
+
import { COVER_CONSTRAINT_DEFAULT_ANCHOR } from './UICoverConstraintBuilder.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Builder for cover layout (like CSS object-fit: cover) */
|
|
12
|
+
class UICoverConstraintBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Creates cover layout constraints.
|
|
15
|
+
* @param passive Container element
|
|
16
|
+
* @param active Content element that covers container
|
|
17
|
+
* @param options Cover configuration
|
|
18
|
+
* @returns Created constraints
|
|
19
|
+
*/
|
|
20
|
+
static build(passive, active, options = {}) {
|
|
21
|
+
if (options.anchorH !== undefined) {
|
|
22
|
+
assertValidNumber(options.anchorH, "UICoverConstraintBuilder.build.anchorH");
|
|
23
|
+
}
|
|
24
|
+
if (options.anchorV !== undefined) {
|
|
25
|
+
assertValidNumber(options.anchorV, "UICoverConstraintBuilder.build.anchorV");
|
|
26
|
+
}
|
|
27
|
+
let activeAspectConstraint;
|
|
28
|
+
if (options.keepActiveAspect !== false) {
|
|
29
|
+
activeAspectConstraint = new UIAspectConstraint(active, {
|
|
30
|
+
orientation: options.orientation,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const xConstraint = new UIHorizontalDistanceConstraint(passive, active, {
|
|
34
|
+
anchorA: options.anchorH ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
35
|
+
anchorB: options.anchorH ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
36
|
+
orientation: options.orientation,
|
|
37
|
+
});
|
|
38
|
+
const yConstraint = new UIVerticalDistanceConstraint(passive, active, {
|
|
39
|
+
anchorA: options.anchorV ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
40
|
+
anchorB: options.anchorV ?? COVER_CONSTRAINT_DEFAULT_ANCHOR,
|
|
41
|
+
orientation: options.orientation,
|
|
42
|
+
});
|
|
43
|
+
const widthConstraint = new UIHorizontalProportionConstraint(passive, active, {
|
|
44
|
+
proportion: 1,
|
|
45
|
+
relation: UIRelation.GREATER_THAN,
|
|
46
|
+
orientation: options.orientation,
|
|
47
|
+
});
|
|
48
|
+
const heightConstraint = new UIVerticalProportionConstraint(passive, active, {
|
|
49
|
+
proportion: 1,
|
|
50
|
+
priority: UIPriority.P1,
|
|
51
|
+
orientation: options.orientation,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
activeAspectConstraint,
|
|
55
|
+
xConstraint,
|
|
56
|
+
yConstraint,
|
|
57
|
+
widthConstraint,
|
|
58
|
+
heightConstraint,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { UICoverConstraintBuilder };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { UIRelation } from '../../miscellaneous/UIRelation.js';
|
|
4
|
+
import { UIAspectConstraint } from '../UIAspectConstraint/UIAspectConstraint.js';
|
|
5
|
+
import { UIHorizontalDistanceConstraint } from '../UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js';
|
|
6
|
+
import { UIHorizontalProportionConstraint } from '../UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js';
|
|
7
|
+
import { UIVerticalDistanceConstraint } from '../UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js';
|
|
8
|
+
import { UIVerticalProportionConstraint } from '../UIVerticalProportionConstraint/UIVerticalProportionConstraint.js';
|
|
9
|
+
import { DEFAULT_ANCHOR } from './UIFitConstraintBuilder.Internal.js';
|
|
10
|
+
|
|
11
|
+
/** Builder for fit layout (like CSS object-fit: contain) */
|
|
12
|
+
class UIFitConstraintBuilder {
|
|
13
|
+
/**
|
|
14
|
+
* Creates fit layout constraints.
|
|
15
|
+
* @param passive Container element
|
|
16
|
+
* @param active Content element that fits within container
|
|
17
|
+
* @param options Fit configuration
|
|
18
|
+
* @returns Created constraints
|
|
19
|
+
*/
|
|
20
|
+
static build(passive, active, options = {}) {
|
|
21
|
+
if (options.anchorH !== undefined) {
|
|
22
|
+
assertValidNumber(options.anchorH, "UIFitConstraintBuilder.build.anchorH");
|
|
23
|
+
}
|
|
24
|
+
if (options.anchorV !== undefined) {
|
|
25
|
+
assertValidNumber(options.anchorV, "UIFitConstraintBuilder.build.anchorV");
|
|
26
|
+
}
|
|
27
|
+
let activeAspectConstraint;
|
|
28
|
+
if (options.keepActiveAspect === true) {
|
|
29
|
+
activeAspectConstraint = new UIAspectConstraint(active, {
|
|
30
|
+
orientation: options.orientation,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const xConstraint = new UIHorizontalDistanceConstraint(passive, active, {
|
|
34
|
+
anchorA: options.anchorH ?? DEFAULT_ANCHOR,
|
|
35
|
+
anchorB: options.anchorH ?? DEFAULT_ANCHOR,
|
|
36
|
+
orientation: options.orientation,
|
|
37
|
+
});
|
|
38
|
+
const yConstraint = new UIVerticalDistanceConstraint(passive, active, {
|
|
39
|
+
anchorA: options.anchorV ?? DEFAULT_ANCHOR,
|
|
40
|
+
anchorB: options.anchorV ?? DEFAULT_ANCHOR,
|
|
41
|
+
orientation: options.orientation,
|
|
42
|
+
});
|
|
43
|
+
const widthConstraint = new UIHorizontalProportionConstraint(passive, active, {
|
|
44
|
+
proportion: 1,
|
|
45
|
+
relation: UIRelation.LESS_THAN,
|
|
46
|
+
orientation: options.orientation,
|
|
47
|
+
});
|
|
48
|
+
const heightConstraint = new UIVerticalProportionConstraint(passive, active, {
|
|
49
|
+
proportion: 1,
|
|
50
|
+
priority: UIPriority.P1,
|
|
51
|
+
orientation: options.orientation,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
activeAspectConstraint,
|
|
55
|
+
xConstraint,
|
|
56
|
+
yConstraint,
|
|
57
|
+
widthConstraint,
|
|
58
|
+
heightConstraint,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { UIFitConstraintBuilder };
|
|
@@ -4,6 +4,9 @@ export interface UIAnchorOptions {
|
|
|
4
4
|
x: number;
|
|
5
5
|
/** Y coordinate in world units */
|
|
6
6
|
y: number;
|
|
7
|
+
/** Identifier for debugging */
|
|
8
|
+
name: string;
|
|
7
9
|
}
|
|
8
10
|
export declare const ANCHOR_DEFAULT_X = 0;
|
|
9
11
|
export declare const ANCHOR_DEFAULT_Y = 0;
|
|
12
|
+
export declare const ANCHOR_DEFAULT_NAME = "";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { UILayer } from "../../layers/UILayer/UILayer";
|
|
2
2
|
import type { UILayerElement, UIPointElement } from "../../miscellaneous/shared";
|
|
3
|
-
import type {
|
|
3
|
+
import type { UISolverWrapperView } from "../../wrappers/UISolverWrapper/UISolverWrapper.Internal";
|
|
4
4
|
import type { UIAnchorOptions } from "./UIAnchor.Internal";
|
|
5
5
|
/** Point in 2D space with constraint-based positioning */
|
|
6
6
|
export declare class UIAnchor implements UILayerElement, UIPointElement {
|
|
7
7
|
readonly layer: UILayer;
|
|
8
|
-
/**
|
|
8
|
+
/** Identifier for debugging */
|
|
9
9
|
name: string;
|
|
10
10
|
/** Solver variable for x coordinate */
|
|
11
11
|
readonly xVariable: number;
|
|
12
12
|
/** Solver variable for y coordinate */
|
|
13
13
|
readonly yVariable: number;
|
|
14
|
-
protected readonly solverWrapper:
|
|
14
|
+
protected readonly solverWrapper: UISolverWrapperView;
|
|
15
15
|
/**
|
|
16
16
|
* Creates a new UIAnchor instance.
|
|
17
17
|
*
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
|
+
import { UIPriority } from '../../miscellaneous/UIPriority.js';
|
|
3
|
+
import { ANCHOR_DEFAULT_X, ANCHOR_DEFAULT_Y, ANCHOR_DEFAULT_NAME } from './UIAnchor.Internal.js';
|
|
4
|
+
|
|
5
|
+
/** Point in 2D space with constraint-based positioning */
|
|
6
|
+
class UIAnchor {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new UIAnchor instance.
|
|
9
|
+
*
|
|
10
|
+
* @param layer - Layer containing this anchor
|
|
11
|
+
* @param options - Configuration options
|
|
12
|
+
*/
|
|
13
|
+
constructor(layer, options) {
|
|
14
|
+
this.layer = layer;
|
|
15
|
+
const x = options?.x ?? ANCHOR_DEFAULT_X;
|
|
16
|
+
const y = options?.y ?? ANCHOR_DEFAULT_Y;
|
|
17
|
+
assertValidNumber(x, "UIAnchor.constructor.options.x");
|
|
18
|
+
assertValidNumber(y, "UIAnchor.constructor.options.y");
|
|
19
|
+
this.solverWrapper = this.layer.solverWrapper;
|
|
20
|
+
this.xVariable = this.solverWrapper.createVariable(x, UIPriority.P7);
|
|
21
|
+
this.yVariable = this.solverWrapper.createVariable(y, UIPriority.P7);
|
|
22
|
+
this.name = options?.name ?? ANCHOR_DEFAULT_NAME;
|
|
23
|
+
}
|
|
24
|
+
/** X coordinate relative to layer origin (bottom-left) */
|
|
25
|
+
get x() {
|
|
26
|
+
return this.solverWrapper.readVariableValue(this.xVariable);
|
|
27
|
+
}
|
|
28
|
+
/** Y coordinate relative to layer origin (bottom-left) */
|
|
29
|
+
get y() {
|
|
30
|
+
return this.solverWrapper.readVariableValue(this.yVariable);
|
|
31
|
+
}
|
|
32
|
+
/** X coordinate relative to layer origin (bottom-left) */
|
|
33
|
+
set x(value) {
|
|
34
|
+
assertValidNumber(value, "UIAnchor.x");
|
|
35
|
+
this.solverWrapper.suggestVariableValue(this.xVariable, value);
|
|
36
|
+
}
|
|
37
|
+
/** Y coordinate relative to layer origin (bottom-left) */
|
|
38
|
+
set y(value) {
|
|
39
|
+
assertValidNumber(value, "UIAnchor.y");
|
|
40
|
+
this.solverWrapper.suggestVariableValue(this.yVariable, value);
|
|
41
|
+
}
|
|
42
|
+
/** Removes anchor and frees resources */
|
|
43
|
+
destroy() {
|
|
44
|
+
this.solverWrapper.removeVariable(this.yVariable);
|
|
45
|
+
this.solverWrapper.removeVariable(this.xVariable);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { UIAnchor };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Animation loop behavior */
|
|
2
|
+
var UIAnimatedImageLoopMode;
|
|
3
|
+
(function (UIAnimatedImageLoopMode) {
|
|
4
|
+
/** No looping, stops at boundary frame */
|
|
5
|
+
UIAnimatedImageLoopMode[UIAnimatedImageLoopMode["NONE"] = 0] = "NONE";
|
|
6
|
+
/** Loops back to opposite frame */
|
|
7
|
+
UIAnimatedImageLoopMode[UIAnimatedImageLoopMode["LOOP"] = 1] = "LOOP";
|
|
8
|
+
/** Reverses direction at boundaries */
|
|
9
|
+
UIAnimatedImageLoopMode[UIAnimatedImageLoopMode["PING_PONG"] = 2] = "PING_PONG";
|
|
10
|
+
})(UIAnimatedImageLoopMode || (UIAnimatedImageLoopMode = {}));
|
|
11
|
+
const ANIMATED_IMAGE_DEFAULT_FRAME_RATE = 24;
|
|
12
|
+
const ANIMATED_IMAGE_DEFAULT_TIME_SCALE = 1;
|
|
13
|
+
const ANIMATED_IMAGE_DEFAULT_LOOP_MODE = UIAnimatedImageLoopMode.LOOP;
|
|
14
|
+
|
|
15
|
+
export { ANIMATED_IMAGE_DEFAULT_FRAME_RATE, ANIMATED_IMAGE_DEFAULT_LOOP_MODE, ANIMATED_IMAGE_DEFAULT_TIME_SCALE, UIAnimatedImageLoopMode };
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Ferrsign0 } from 'ferrsign';
|
|
2
|
+
import { assertValidPositiveNumber, assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
|
+
import { UIColor } from '../../miscellaneous/color/UIColor.js';
|
|
4
|
+
import { computeTrimmedTransformMatrix } from '../../miscellaneous/computeTransform.js';
|
|
5
|
+
import { UITextureView } from '../../miscellaneous/texture/UITextureView.js';
|
|
6
|
+
import source from '../../shaders/UIImage.glsl.js';
|
|
7
|
+
import { UIElement } from '../UIElement/UIElement.js';
|
|
8
|
+
import { ANIMATED_IMAGE_DEFAULT_FRAME_RATE, ANIMATED_IMAGE_DEFAULT_TIME_SCALE, ANIMATED_IMAGE_DEFAULT_LOOP_MODE, UIAnimatedImageLoopMode } from './UIAnimatedImage.Internal.js';
|
|
9
|
+
|
|
10
|
+
/** Frame-based texture animation element */
|
|
11
|
+
class UIAnimatedImage extends UIElement {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new UIAnimatedImage instance.
|
|
14
|
+
*
|
|
15
|
+
* Defaults size to first frame dimensions if width and height not provided.
|
|
16
|
+
*
|
|
17
|
+
* @param layer - Layer containing this element
|
|
18
|
+
* @param sequence - Array of textures forming animation
|
|
19
|
+
* @param options - Configuration options
|
|
20
|
+
*/
|
|
21
|
+
constructor(layer, sequence, options = {}) {
|
|
22
|
+
const color = new UIColor(options.color);
|
|
23
|
+
const uiTextures = sequence.map((textureConfig) => new UITextureView(textureConfig));
|
|
24
|
+
const frame = uiTextures[0];
|
|
25
|
+
options.width = options.width ?? frame.width;
|
|
26
|
+
options.height = options.height ?? frame.height;
|
|
27
|
+
const textureTransform = frame.calculateUVTransform();
|
|
28
|
+
super(layer, source, {
|
|
29
|
+
texture: frame.texture,
|
|
30
|
+
textureTransform: textureTransform,
|
|
31
|
+
color,
|
|
32
|
+
}, options);
|
|
33
|
+
this._private_isPlaying = false;
|
|
34
|
+
this._private_sequenceFrameIndex = 0;
|
|
35
|
+
this._private_currentFrameIndexDirty = false;
|
|
36
|
+
this._private_accumulatedTime = 0;
|
|
37
|
+
this._private_signalPlayedInternal = new Ferrsign0();
|
|
38
|
+
this._private_signalPausedInternal = new Ferrsign0();
|
|
39
|
+
this._private_signalStoppedInternal = new Ferrsign0();
|
|
40
|
+
this._private_onTextureDimensionsChanged = (width, height, texture) => {
|
|
41
|
+
if (this._private_sequenceInternal[this._private_sequenceFrameIndex] === texture) {
|
|
42
|
+
this.width = width;
|
|
43
|
+
this.height = height;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
this._private_colorInternal = color;
|
|
47
|
+
this._private_sequenceInternal = uiTextures;
|
|
48
|
+
this._private_textureTransform = textureTransform;
|
|
49
|
+
this._private_frameRateInternal = options.frameRate ?? ANIMATED_IMAGE_DEFAULT_FRAME_RATE;
|
|
50
|
+
this._private_timeScaleInternal = options.timeScale ?? ANIMATED_IMAGE_DEFAULT_TIME_SCALE;
|
|
51
|
+
this._private_loopModeInternal = options.loopMode ?? ANIMATED_IMAGE_DEFAULT_LOOP_MODE;
|
|
52
|
+
this._private_subscribeSequenceEvents();
|
|
53
|
+
if (options.playByDefault === true) {
|
|
54
|
+
this.play();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
58
|
+
get color() {
|
|
59
|
+
return this._private_colorInternal;
|
|
60
|
+
}
|
|
61
|
+
/** Total animation duration in seconds */
|
|
62
|
+
get duration() {
|
|
63
|
+
return this._private_sequenceInternal.length / this._private_frameRateInternal;
|
|
64
|
+
}
|
|
65
|
+
/** Animation speed in frames per second */
|
|
66
|
+
get frameRate() {
|
|
67
|
+
return this._private_frameRateInternal;
|
|
68
|
+
}
|
|
69
|
+
/** Loop behavior */
|
|
70
|
+
get loopMode() {
|
|
71
|
+
return this._private_loopModeInternal;
|
|
72
|
+
}
|
|
73
|
+
/** Animation frames as readonly array */
|
|
74
|
+
get sequence() {
|
|
75
|
+
return this._private_sequenceInternal;
|
|
76
|
+
}
|
|
77
|
+
/** Playback speed multiplier. Can be negative for reverse playback. */
|
|
78
|
+
get timeScale() {
|
|
79
|
+
return this._private_timeScaleInternal;
|
|
80
|
+
}
|
|
81
|
+
/** Signal fired when animation starts or resumes */
|
|
82
|
+
get signalPlayed() {
|
|
83
|
+
return this._private_signalPlayedInternal;
|
|
84
|
+
}
|
|
85
|
+
/** Signal fired when animation pauses */
|
|
86
|
+
get signalPaused() {
|
|
87
|
+
return this._private_signalPausedInternal;
|
|
88
|
+
}
|
|
89
|
+
/** Signal fired when animation stops and resets */
|
|
90
|
+
get signalStopped() {
|
|
91
|
+
return this._private_signalStoppedInternal;
|
|
92
|
+
}
|
|
93
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
94
|
+
set color(value) {
|
|
95
|
+
this._private_colorInternal.set(value);
|
|
96
|
+
}
|
|
97
|
+
/** Animation speed in frames per second */
|
|
98
|
+
set frameRate(value) {
|
|
99
|
+
assertValidPositiveNumber(value, "UIAnimatedImage.frameRate");
|
|
100
|
+
this._private_frameRateInternal = value;
|
|
101
|
+
}
|
|
102
|
+
/** Loop behavior */
|
|
103
|
+
set loopMode(value) {
|
|
104
|
+
this._private_loopModeInternal = value;
|
|
105
|
+
}
|
|
106
|
+
/** Replaces animation frames. Stops playback. */
|
|
107
|
+
set sequence(sequence) {
|
|
108
|
+
this.stop();
|
|
109
|
+
this._private_unsubscribeSequenceEvents();
|
|
110
|
+
const newLength = sequence.length;
|
|
111
|
+
const currentLength = this._private_sequenceInternal.length;
|
|
112
|
+
for (let i = 0; i < Math.min(newLength, currentLength); i++) {
|
|
113
|
+
this._private_sequenceInternal[i].set(sequence[i]);
|
|
114
|
+
}
|
|
115
|
+
if (newLength < currentLength) {
|
|
116
|
+
this._private_sequenceInternal.length = newLength;
|
|
117
|
+
}
|
|
118
|
+
else if (newLength > currentLength) {
|
|
119
|
+
for (let i = currentLength; i < newLength; i++) {
|
|
120
|
+
this._private_sequenceInternal.push(new UITextureView(sequence[i]));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this._private_subscribeSequenceEvents();
|
|
124
|
+
}
|
|
125
|
+
/** Playback speed multiplier. Can be negative for reverse playback. */
|
|
126
|
+
set timeScale(value) {
|
|
127
|
+
assertValidNumber(value, "UIAnimatedImage.timeScale");
|
|
128
|
+
this._private_timeScaleInternal = value;
|
|
129
|
+
}
|
|
130
|
+
/** Removes element and frees resources */
|
|
131
|
+
destroy() {
|
|
132
|
+
this._private_unsubscribeSequenceEvents();
|
|
133
|
+
super.destroy();
|
|
134
|
+
}
|
|
135
|
+
/** Starts or resumes animation playback */
|
|
136
|
+
play() {
|
|
137
|
+
if (!this._private_isPlaying) {
|
|
138
|
+
this._private_isPlaying = true;
|
|
139
|
+
this._private_signalPlayedInternal.emit();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** Pauses animation at current frame */
|
|
143
|
+
pause() {
|
|
144
|
+
if (this._private_isPlaying) {
|
|
145
|
+
this._private_isPlaying = false;
|
|
146
|
+
this._private_signalPausedInternal.emit();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** Stops animation and resets to first frame */
|
|
150
|
+
stop() {
|
|
151
|
+
if (this._private_isPlaying || this._private_accumulatedTime > 0 || this._private_sequenceFrameIndex > 0) {
|
|
152
|
+
this._private_isPlaying = false;
|
|
153
|
+
this._private_accumulatedTime = 0;
|
|
154
|
+
this._private_sequenceFrameIndex = 0;
|
|
155
|
+
this._private_currentFrameIndexDirty = true;
|
|
156
|
+
this._private_signalStoppedInternal.emit();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
onWillRender(renderer, deltaTime) {
|
|
160
|
+
if (this._private_isPlaying && this._private_timeScaleInternal !== 0) {
|
|
161
|
+
this._private_accumulatedTime += deltaTime * this._private_timeScaleInternal;
|
|
162
|
+
const frameDuration = 1 / this._private_frameRateInternal;
|
|
163
|
+
const sequenceLength = this._private_sequenceInternal.length;
|
|
164
|
+
const lastFrameIndex = sequenceLength - 1;
|
|
165
|
+
if (this._private_timeScaleInternal > 0) {
|
|
166
|
+
while (this._private_accumulatedTime >= frameDuration) {
|
|
167
|
+
this._private_accumulatedTime -= frameDuration;
|
|
168
|
+
this._private_sequenceFrameIndex += 1;
|
|
169
|
+
if (this._private_sequenceFrameIndex >= sequenceLength) {
|
|
170
|
+
if (this._private_loopModeInternal === UIAnimatedImageLoopMode.LOOP) {
|
|
171
|
+
this._private_sequenceFrameIndex = 0;
|
|
172
|
+
}
|
|
173
|
+
else if (this._private_loopModeInternal === UIAnimatedImageLoopMode.PING_PONG) {
|
|
174
|
+
this._private_sequenceFrameIndex = lastFrameIndex;
|
|
175
|
+
this._private_timeScaleInternal = -this._private_timeScaleInternal;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this._private_sequenceFrameIndex = lastFrameIndex;
|
|
179
|
+
this._private_isPlaying = false;
|
|
180
|
+
this._private_signalPausedInternal.emit();
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
this._private_currentFrameIndexDirty = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
while (this._private_accumulatedTime <= -frameDuration) {
|
|
189
|
+
this._private_accumulatedTime += frameDuration;
|
|
190
|
+
this._private_sequenceFrameIndex -= 1;
|
|
191
|
+
if (this._private_sequenceFrameIndex < 0) {
|
|
192
|
+
if (this._private_loopModeInternal === UIAnimatedImageLoopMode.LOOP) {
|
|
193
|
+
this._private_sequenceFrameIndex = lastFrameIndex;
|
|
194
|
+
}
|
|
195
|
+
else if (this._private_loopModeInternal === UIAnimatedImageLoopMode.PING_PONG) {
|
|
196
|
+
this._private_sequenceFrameIndex = 0;
|
|
197
|
+
this._private_timeScaleInternal = -this._private_timeScaleInternal;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
this._private_sequenceFrameIndex = 0;
|
|
201
|
+
this._private_isPlaying = false;
|
|
202
|
+
this._private_signalPausedInternal.emit();
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
this._private_currentFrameIndexDirty = true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
super.onWillRender(renderer, deltaTime);
|
|
211
|
+
}
|
|
212
|
+
setPlaneTransform() {
|
|
213
|
+
let properties;
|
|
214
|
+
if (this._private_colorInternal.dirty) {
|
|
215
|
+
properties ?? (properties = {});
|
|
216
|
+
properties["color"] = this._private_colorInternal;
|
|
217
|
+
this._private_colorInternal.setDirtyFalse();
|
|
218
|
+
}
|
|
219
|
+
const frame = this._private_sequenceInternal[this._private_sequenceFrameIndex];
|
|
220
|
+
if (frame.textureDirty || this._private_currentFrameIndexDirty) {
|
|
221
|
+
properties ?? (properties = {});
|
|
222
|
+
properties["texture"] = frame.texture;
|
|
223
|
+
frame.setTextureDirtyFalse();
|
|
224
|
+
}
|
|
225
|
+
if (frame.uvTransformDirty || this._private_currentFrameIndexDirty) {
|
|
226
|
+
properties ?? (properties = {});
|
|
227
|
+
properties["textureTransform"] = frame.calculateUVTransform(this._private_textureTransform);
|
|
228
|
+
frame.setUVTransformDirtyFalse();
|
|
229
|
+
}
|
|
230
|
+
if (properties) {
|
|
231
|
+
this.sceneWrapper.setProperties(this.planeHandler, properties);
|
|
232
|
+
}
|
|
233
|
+
const isTransformDirty = this._private_currentFrameIndexDirty ||
|
|
234
|
+
this.micro.dirty ||
|
|
235
|
+
frame.trimDirty ||
|
|
236
|
+
this.inputWrapper.dirty ||
|
|
237
|
+
this.solverWrapper.dirty;
|
|
238
|
+
if (isTransformDirty) {
|
|
239
|
+
const micro = this.micro;
|
|
240
|
+
const textureTrim = frame.trim;
|
|
241
|
+
this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
|
|
242
|
+
this._private_currentFrameIndexDirty = false;
|
|
243
|
+
this.micro.setDirtyFalse();
|
|
244
|
+
frame.setTrimDirtyFalse();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
_private_subscribeSequenceEvents() {
|
|
248
|
+
for (const frame of this._private_sequenceInternal) {
|
|
249
|
+
frame.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
_private_unsubscribeSequenceEvents() {
|
|
253
|
+
for (const frame of this._private_sequenceInternal) {
|
|
254
|
+
frame.signalDiminsionsChanged.off(this._private_onTextureDimensionsChanged);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export { UIAnimatedImage };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UIMode } from '../../miscellaneous/UIMode.js';
|
|
2
|
+
|
|
3
|
+
const DUMMY_DEFAULT_WIDTH = 64;
|
|
4
|
+
const DUMMY_DEFAULT_HEIGHT = 32;
|
|
5
|
+
const DUMMY_DEFAULT_MODE = UIMode.VISIBLE;
|
|
6
|
+
const DUMMY_DEFAULT_Z_INDEX = 0;
|
|
7
|
+
|
|
8
|
+
export { DUMMY_DEFAULT_HEIGHT, DUMMY_DEFAULT_MODE, DUMMY_DEFAULT_WIDTH, DUMMY_DEFAULT_Z_INDEX };
|
|
@@ -4,7 +4,7 @@ import type { UILayer } from "../../layers/UILayer/UILayer";
|
|
|
4
4
|
import type { UIArea } from "../../miscellaneous/area/UIArea";
|
|
5
5
|
import type { UIPlaneElement } from "../../miscellaneous/shared";
|
|
6
6
|
import { UIMode } from "../../miscellaneous/UIMode";
|
|
7
|
-
import type {
|
|
7
|
+
import type { UIInputWrapperView } from "../../wrappers/UIInputWrapper/UIInputWrapper.Internal";
|
|
8
8
|
import { UIAnchor } from "../UIAnchor/UIAnchor";
|
|
9
9
|
import type { UIDummyOptions, UIInputEventData } from "./UIDummy.Internal";
|
|
10
10
|
/** Rectangular area with dimensions but no rendering */
|
|
@@ -16,7 +16,7 @@ export declare class UIDummy extends UIAnchor implements UIPlaneElement {
|
|
|
16
16
|
/** Solver variable for height */
|
|
17
17
|
readonly hVariable: number;
|
|
18
18
|
protected modeInternal: UIMode;
|
|
19
|
-
protected readonly inputWrapper:
|
|
19
|
+
protected readonly inputWrapper: UIInputWrapperView;
|
|
20
20
|
private readonly catcherHandler;
|
|
21
21
|
private wasPointerInside;
|
|
22
22
|
private readonly signalPointerPressedInternal;
|