laymur 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
- package/dist/core/constraints/UIConstraint.d.ts +22 -2
- package/dist/core/constraints/UIConstraint.js +26 -3
- package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
- package/dist/core/constraints/UICustomConstraint.js +15 -15
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
- package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
- package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
- package/dist/core/elements/UIDummy/UIDummy.js +59 -42
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
- package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
- package/dist/core/elements/UIElement/UIElement.d.ts +11 -11
- package/dist/core/elements/UIElement/UIElement.js +57 -60
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
- package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
- package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
- package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
- package/dist/core/elements/UIImage/UIImage.js +21 -24
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
- package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
- package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -10
- package/dist/core/elements/UIProgress/UIProgress.js +59 -62
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
- package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
- package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
- package/dist/core/elements/UIScene/UIScene.js +68 -69
- package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
- package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
- package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
- package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
- package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
- package/dist/core/elements/UIText/UIText.Internal.js +5 -7
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
- package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
- package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
- package/dist/core/elements/UIText/UIText.d.ts +28 -14
- package/dist/core/elements/UIText/UIText.js +181 -141
- package/dist/core/index.d.ts +55 -54
- package/dist/core/index.js +53 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
- package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
- package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
- package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
- package/dist/core/layers/UILayer/UILayer.js +125 -62
- package/dist/core/miscellaneous/UIBlendMode.js +1 -3
- package/dist/core/miscellaneous/UIExpression.js +16 -19
- package/dist/core/miscellaneous/UIMode.js +3 -5
- package/dist/core/miscellaneous/UIOrientation.js +2 -4
- package/dist/core/miscellaneous/UIPriority.js +5 -8
- package/dist/core/miscellaneous/UIRelation.js +5 -8
- package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
- package/dist/core/miscellaneous/area/UIArea.js +1 -3
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
- package/dist/core/miscellaneous/asserts.d.ts +20 -1
- package/dist/core/miscellaneous/asserts.js +71 -19
- package/dist/core/miscellaneous/canvas.js +13 -7
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
- package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.js +202 -205
- package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
- package/dist/core/miscellaneous/computeTransform.js +4 -7
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +2 -2
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +13 -16
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +115 -118
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +208 -114
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +2 -2
- package/dist/core/miscellaneous/generic-plane/shared.js +16 -19
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
- package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +13 -16
- package/dist/core/miscellaneous/math.js +3 -5
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
- package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
- package/dist/core/miscellaneous/shared.d.ts +1 -1
- package/dist/core/miscellaneous/shared.js +4 -7
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
- package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
- package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +1 -1
- package/dist/core/miscellaneous/texture/UITextureView.js +113 -117
- package/dist/core/miscellaneous/webglCapabilities.js +3 -4
- package/dist/core/shaders/UIImage.d.ts +9 -0
- package/dist/core/shaders/UIImage.js +14 -0
- package/dist/core/shaders/UINineSlice.d.ts +11 -0
- package/dist/core/shaders/UINineSlice.js +57 -0
- package/dist/core/shaders/UIProgress.d.ts +14 -0
- package/dist/core/shaders/UIProgress.js +21 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +20 -4
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +138 -117
- package/dist/debug/UIAspectDebug.d.ts +3 -3
- package/dist/debug/UIAspectDebug.js +64 -68
- package/dist/debug/UIConstraintDebug.d.ts +1 -1
- package/dist/debug/UIConstraintDebug.js +1 -0
- package/dist/debug/UIHeightDebug.d.ts +3 -3
- package/dist/debug/UIHeightDebug.js +63 -67
- package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
- package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
- package/dist/debug/UILayerDebug.d.ts +1 -1
- package/dist/debug/UILayerDebug.js +55 -64
- package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIVerticalDistanceDebug.js +76 -81
- package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
- package/dist/debug/UIWidthDebug.d.ts +3 -3
- package/dist/debug/UIWidthDebug.js +63 -67
- package/dist/debug/index.d.ts +8 -8
- package/dist/debug/index.js +8 -8
- package/dist/debug/miscellaneous.js +8 -11
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
- package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
- package/dist/particles/elements/UIEmitter.Internal.js +6 -9
- package/dist/particles/elements/UIEmitter.d.ts +17 -11
- package/dist/particles/elements/UIEmitter.js +100 -88
- package/dist/particles/index.d.ts +20 -18
- package/dist/particles/index.js +19 -18
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.js +29 -32
- package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
- package/dist/particles/miscellaneous/miscellaneous.js +26 -27
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
- package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
- package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
- package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingTexture.js +7 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnModule.js +1 -3
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
- package/package.json +13 -17
- package/dist/_virtual/2d.js +0 -3
- package/dist/_virtual/3d.js +0 -3
- package/dist/_virtual/4d.js +0 -3
- package/dist/_virtual/mod.js +0 -5
- package/dist/_virtual/mod2.js +0 -3
- package/dist/core/shaders/UIImage.glsl.js +0 -3
- package/dist/core/shaders/UINineSlice.glsl.js +0 -3
- package/dist/core/shaders/UIProgress.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
- package/dist/index.js +0 -52
- package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
- package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
- package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
- package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
- package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
- package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
- package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
- package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
- package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { assertValidNumber } from
|
|
3
|
-
import {
|
|
4
|
-
import { COLORS } from
|
|
5
|
-
|
|
1
|
+
import { Color, MathUtils, Vector4 } from "three";
|
|
2
|
+
import { assertValidNumber } from "../asserts.js";
|
|
3
|
+
import { linearToSRGB, srgbToLinear } from "../math.js";
|
|
4
|
+
import { COLORS } from "./UIColor.Internal.js";
|
|
6
5
|
/** RGBA color with RGB, HSL, hex, and named color support */
|
|
7
|
-
class UIColor {
|
|
6
|
+
export class UIColor {
|
|
8
7
|
constructor(...args) {
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
8
|
+
this.rInternal = 1;
|
|
9
|
+
this.gInternal = 1;
|
|
10
|
+
this.bInternal = 1;
|
|
11
|
+
this.aInternal = 1;
|
|
12
|
+
this.hInternal = 0;
|
|
13
|
+
this.sInternal = 0;
|
|
14
|
+
this.lInternal = 1;
|
|
15
|
+
this.dirtyInternal = false;
|
|
16
|
+
this.rgbDirty = false;
|
|
17
|
+
this.hslDirty = false;
|
|
19
18
|
if (args.length > 0) {
|
|
20
19
|
this.set(...args);
|
|
21
20
|
}
|
|
@@ -174,120 +173,120 @@ class UIColor {
|
|
|
174
173
|
}
|
|
175
174
|
/** Red component (0 to 1) */
|
|
176
175
|
get r() {
|
|
177
|
-
this.
|
|
178
|
-
return this.
|
|
176
|
+
this.ensureRGBUpdatedFromHSL();
|
|
177
|
+
return this.rInternal;
|
|
179
178
|
}
|
|
180
179
|
/** Green component (0 to 1) */
|
|
181
180
|
get g() {
|
|
182
|
-
this.
|
|
183
|
-
return this.
|
|
181
|
+
this.ensureRGBUpdatedFromHSL();
|
|
182
|
+
return this.gInternal;
|
|
184
183
|
}
|
|
185
184
|
/** Blue component (0 to 1) */
|
|
186
185
|
get b() {
|
|
187
|
-
this.
|
|
188
|
-
return this.
|
|
186
|
+
this.ensureRGBUpdatedFromHSL();
|
|
187
|
+
return this.bInternal;
|
|
189
188
|
}
|
|
190
189
|
/** Alpha component (0 to 1) */
|
|
191
190
|
get a() {
|
|
192
|
-
return this.
|
|
191
|
+
return this.aInternal;
|
|
193
192
|
}
|
|
194
193
|
/** Hue component (0 to 360) */
|
|
195
194
|
get hue() {
|
|
196
|
-
this.
|
|
197
|
-
return this.
|
|
195
|
+
this.ensureHSLUpdatedFromRGB();
|
|
196
|
+
return this.hInternal;
|
|
198
197
|
}
|
|
199
198
|
/** Saturation component (0 to 1) */
|
|
200
199
|
get saturation() {
|
|
201
|
-
this.
|
|
202
|
-
return this.
|
|
200
|
+
this.ensureHSLUpdatedFromRGB();
|
|
201
|
+
return this.sInternal;
|
|
203
202
|
}
|
|
204
203
|
/** Lightness component (0 to 1) */
|
|
205
204
|
get lightness() {
|
|
206
|
-
this.
|
|
207
|
-
return this.
|
|
205
|
+
this.ensureHSLUpdatedFromRGB();
|
|
206
|
+
return this.lInternal;
|
|
208
207
|
}
|
|
209
208
|
/** @internal */
|
|
210
209
|
get dirty() {
|
|
211
|
-
return this.
|
|
210
|
+
return this.dirtyInternal;
|
|
212
211
|
}
|
|
213
212
|
/** Red component (0 to 1) */
|
|
214
213
|
set r(value) {
|
|
215
214
|
assertValidNumber(value, "UIColor.r");
|
|
216
215
|
value = MathUtils.clamp(value, 0, 1);
|
|
217
|
-
this.
|
|
218
|
-
if (value !== this.
|
|
219
|
-
this.
|
|
220
|
-
this.
|
|
221
|
-
this.
|
|
216
|
+
this.ensureRGBUpdatedFromHSL();
|
|
217
|
+
if (value !== this.rInternal) {
|
|
218
|
+
this.rInternal = value;
|
|
219
|
+
this.hslDirty = true;
|
|
220
|
+
this.dirtyInternal = true;
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
223
|
/** Green component (0 to 1) */
|
|
225
224
|
set g(value) {
|
|
226
225
|
assertValidNumber(value, "UIColor.g");
|
|
227
226
|
value = MathUtils.clamp(value, 0, 1);
|
|
228
|
-
this.
|
|
229
|
-
if (value !== this.
|
|
230
|
-
this.
|
|
231
|
-
this.
|
|
232
|
-
this.
|
|
227
|
+
this.ensureRGBUpdatedFromHSL();
|
|
228
|
+
if (value !== this.gInternal) {
|
|
229
|
+
this.gInternal = value;
|
|
230
|
+
this.hslDirty = true;
|
|
231
|
+
this.dirtyInternal = true;
|
|
233
232
|
}
|
|
234
233
|
}
|
|
235
234
|
/** Blue component (0 to 1) */
|
|
236
235
|
set b(value) {
|
|
237
236
|
assertValidNumber(value, "UIColor.b");
|
|
238
237
|
value = MathUtils.clamp(value, 0, 1);
|
|
239
|
-
this.
|
|
240
|
-
if (value !== this.
|
|
241
|
-
this.
|
|
242
|
-
this.
|
|
243
|
-
this.
|
|
238
|
+
this.ensureRGBUpdatedFromHSL();
|
|
239
|
+
if (value !== this.bInternal) {
|
|
240
|
+
this.bInternal = value;
|
|
241
|
+
this.hslDirty = true;
|
|
242
|
+
this.dirtyInternal = true;
|
|
244
243
|
}
|
|
245
244
|
}
|
|
246
245
|
/** Alpha component (0 to 1) */
|
|
247
246
|
set a(value) {
|
|
248
247
|
assertValidNumber(value, "UIColor.a");
|
|
249
248
|
value = MathUtils.clamp(value, 0, 1);
|
|
250
|
-
if (value !== this.
|
|
251
|
-
this.
|
|
252
|
-
this.
|
|
249
|
+
if (value !== this.aInternal) {
|
|
250
|
+
this.aInternal = value;
|
|
251
|
+
this.dirtyInternal = true;
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
254
|
/** Hue component (0 to 360) */
|
|
256
255
|
set hue(value) {
|
|
257
256
|
assertValidNumber(value, "UIColor.hue");
|
|
258
257
|
value = MathUtils.clamp(value, 0, 360);
|
|
259
|
-
this.
|
|
260
|
-
if (value !== this.
|
|
261
|
-
this.
|
|
262
|
-
this.
|
|
263
|
-
this.
|
|
258
|
+
this.ensureHSLUpdatedFromRGB();
|
|
259
|
+
if (value !== this.hInternal) {
|
|
260
|
+
this.hInternal = value;
|
|
261
|
+
this.rgbDirty = true;
|
|
262
|
+
this.dirtyInternal = true;
|
|
264
263
|
}
|
|
265
264
|
}
|
|
266
265
|
/** Saturation component (0 to 1) */
|
|
267
266
|
set saturation(value) {
|
|
268
267
|
assertValidNumber(value, "UIColor.saturation");
|
|
269
268
|
value = MathUtils.clamp(value, 0, 1);
|
|
270
|
-
this.
|
|
271
|
-
if (value !== this.
|
|
272
|
-
this.
|
|
273
|
-
this.
|
|
274
|
-
this.
|
|
269
|
+
this.ensureHSLUpdatedFromRGB();
|
|
270
|
+
if (value !== this.sInternal) {
|
|
271
|
+
this.sInternal = value;
|
|
272
|
+
this.rgbDirty = true;
|
|
273
|
+
this.dirtyInternal = true;
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
/** Lightness component (0 to 1) */
|
|
278
277
|
set lightness(value) {
|
|
279
278
|
assertValidNumber(value, "UIColor.lightness");
|
|
280
279
|
value = MathUtils.clamp(value, 0, 1);
|
|
281
|
-
this.
|
|
282
|
-
if (value !== this.
|
|
283
|
-
this.
|
|
284
|
-
this.
|
|
285
|
-
this.
|
|
280
|
+
this.ensureHSLUpdatedFromRGB();
|
|
281
|
+
if (value !== this.lInternal) {
|
|
282
|
+
this.lInternal = value;
|
|
283
|
+
this.rgbDirty = true;
|
|
284
|
+
this.dirtyInternal = true;
|
|
286
285
|
}
|
|
287
286
|
}
|
|
288
287
|
/** @internal */
|
|
289
288
|
setDirtyFalse() {
|
|
290
|
-
this.
|
|
289
|
+
this.dirtyInternal = false;
|
|
291
290
|
}
|
|
292
291
|
set(...args) {
|
|
293
292
|
if (args.length === 0 || args[0] === undefined) {
|
|
@@ -315,7 +314,7 @@ class UIColor {
|
|
|
315
314
|
throw new Error("UIColor.set: cannot create color from provided arguments");
|
|
316
315
|
}
|
|
317
316
|
/** Sets RGBA components directly */
|
|
318
|
-
setRGBA(r, g, b, a = this.
|
|
317
|
+
setRGBA(r, g, b, a = this.aInternal) {
|
|
319
318
|
assertValidNumber(r, "UIColor.setRGBA.r");
|
|
320
319
|
assertValidNumber(g, "UIColor.setRGBA.g");
|
|
321
320
|
assertValidNumber(b, "UIColor.setRGBA.b");
|
|
@@ -324,34 +323,34 @@ class UIColor {
|
|
|
324
323
|
g = MathUtils.clamp(g, 0, 1);
|
|
325
324
|
b = MathUtils.clamp(b, 0, 1);
|
|
326
325
|
a = MathUtils.clamp(a, 0, 1);
|
|
327
|
-
this.
|
|
328
|
-
if (r !== this.
|
|
329
|
-
g !== this.
|
|
330
|
-
b !== this.
|
|
331
|
-
a !== this.
|
|
332
|
-
this.
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
335
|
-
this.
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
326
|
+
this.ensureRGBUpdatedFromHSL();
|
|
327
|
+
if (r !== this.rInternal ||
|
|
328
|
+
g !== this.gInternal ||
|
|
329
|
+
b !== this.bInternal ||
|
|
330
|
+
a !== this.aInternal) {
|
|
331
|
+
this.rInternal = r;
|
|
332
|
+
this.gInternal = g;
|
|
333
|
+
this.bInternal = b;
|
|
334
|
+
this.aInternal = a;
|
|
335
|
+
this.hslDirty = true;
|
|
336
|
+
this.dirtyInternal = true;
|
|
338
337
|
}
|
|
339
338
|
return this;
|
|
340
339
|
}
|
|
341
340
|
/** Returns RGBA as 32-bit hex (RRGGBBAA) */
|
|
342
341
|
getHexRGBA() {
|
|
343
|
-
this.
|
|
344
|
-
return ((Math.round(this.
|
|
345
|
-
(Math.round(this.
|
|
346
|
-
(Math.round(this.
|
|
347
|
-
Math.round(this.
|
|
342
|
+
this.ensureRGBUpdatedFromHSL();
|
|
343
|
+
return ((Math.round(this.rInternal * 255) << 24) |
|
|
344
|
+
(Math.round(this.gInternal * 255) << 16) |
|
|
345
|
+
(Math.round(this.bInternal * 255) << 8) |
|
|
346
|
+
Math.round(this.aInternal * 255));
|
|
348
347
|
}
|
|
349
348
|
/** Returns RGB as 24-bit hex (RRGGBB) */
|
|
350
349
|
getHexRGB() {
|
|
351
|
-
this.
|
|
352
|
-
return ((Math.round(this.
|
|
353
|
-
(Math.round(this.
|
|
354
|
-
Math.round(this.
|
|
350
|
+
this.ensureRGBUpdatedFromHSL();
|
|
351
|
+
return ((Math.round(this.rInternal * 255) << 16) |
|
|
352
|
+
(Math.round(this.gInternal * 255) << 8) |
|
|
353
|
+
Math.round(this.bInternal * 255));
|
|
355
354
|
}
|
|
356
355
|
/** Returns RGB as hex string ("#ffffff") */
|
|
357
356
|
getHexStringRGB() {
|
|
@@ -366,43 +365,43 @@ class UIColor {
|
|
|
366
365
|
/** Sets from 32-bit hex RGBA (RRGGBBAA) */
|
|
367
366
|
setHexRGBA(hex) {
|
|
368
367
|
assertValidNumber(hex, "UIColor.setHexRGBA.hex");
|
|
369
|
-
this.
|
|
368
|
+
this.ensureRGBUpdatedFromHSL();
|
|
370
369
|
const r = ((hex >> 24) & 0xff) / 255;
|
|
371
370
|
const g = ((hex >> 16) & 0xff) / 255;
|
|
372
371
|
const b = ((hex >> 8) & 0xff) / 255;
|
|
373
372
|
const a = (hex & 0xff) / 255;
|
|
374
|
-
if (r !== this.
|
|
375
|
-
g !== this.
|
|
376
|
-
b !== this.
|
|
377
|
-
a !== this.
|
|
378
|
-
this.
|
|
379
|
-
this.
|
|
380
|
-
this.
|
|
381
|
-
this.
|
|
382
|
-
this.
|
|
383
|
-
this.
|
|
373
|
+
if (r !== this.rInternal ||
|
|
374
|
+
g !== this.gInternal ||
|
|
375
|
+
b !== this.bInternal ||
|
|
376
|
+
a !== this.aInternal) {
|
|
377
|
+
this.rInternal = r;
|
|
378
|
+
this.gInternal = g;
|
|
379
|
+
this.bInternal = b;
|
|
380
|
+
this.aInternal = a;
|
|
381
|
+
this.hslDirty = true;
|
|
382
|
+
this.dirtyInternal = true;
|
|
384
383
|
}
|
|
385
384
|
return this;
|
|
386
385
|
}
|
|
387
386
|
/** Sets from 24-bit hex RGB (RRGGBB) */
|
|
388
|
-
setHexRGB(hex, a = this.
|
|
387
|
+
setHexRGB(hex, a = this.aInternal) {
|
|
389
388
|
assertValidNumber(hex, "UIColor.setHexRGB.hex");
|
|
390
389
|
assertValidNumber(a, "UIColor.setHexRGB.a");
|
|
391
390
|
a = MathUtils.clamp(a, 0, 1);
|
|
392
|
-
this.
|
|
391
|
+
this.ensureRGBUpdatedFromHSL();
|
|
393
392
|
const r = ((hex >> 16) & 0xff) / 255;
|
|
394
393
|
const g = ((hex >> 8) & 0xff) / 255;
|
|
395
394
|
const b = (hex & 0xff) / 255;
|
|
396
|
-
if (r !== this.
|
|
397
|
-
g !== this.
|
|
398
|
-
b !== this.
|
|
399
|
-
a !== this.
|
|
400
|
-
this.
|
|
401
|
-
this.
|
|
402
|
-
this.
|
|
403
|
-
this.
|
|
404
|
-
this.
|
|
405
|
-
this.
|
|
395
|
+
if (r !== this.rInternal ||
|
|
396
|
+
g !== this.gInternal ||
|
|
397
|
+
b !== this.bInternal ||
|
|
398
|
+
a !== this.aInternal) {
|
|
399
|
+
this.rInternal = r;
|
|
400
|
+
this.gInternal = g;
|
|
401
|
+
this.bInternal = b;
|
|
402
|
+
this.aInternal = a;
|
|
403
|
+
this.hslDirty = true;
|
|
404
|
+
this.dirtyInternal = true;
|
|
406
405
|
}
|
|
407
406
|
return this;
|
|
408
407
|
}
|
|
@@ -414,29 +413,29 @@ class UIColor {
|
|
|
414
413
|
*/
|
|
415
414
|
setHexString(hexString) {
|
|
416
415
|
if (!hexString.startsWith("#")) {
|
|
417
|
-
throw new Error(`UIColor.setHexString.hexString: invalid hex string
|
|
416
|
+
throw new Error(`UIColor.setHexString.hexString: invalid hex string "${hexString}", expected "#ffffff" or "#ffffffff"`);
|
|
418
417
|
}
|
|
419
418
|
const hex = hexString.slice(1);
|
|
420
419
|
if (hex.length === 6) {
|
|
421
420
|
const hexNumber = parseInt(hex, 16);
|
|
422
421
|
if (isNaN(hexNumber)) {
|
|
423
|
-
throw new Error(`UIColor.setHexString.hexString: invalid hex string
|
|
422
|
+
throw new Error(`UIColor.setHexString.hexString: invalid hex string "${hexString}", expected "#ffffff" or "#ffffffff"`);
|
|
424
423
|
}
|
|
425
424
|
return this.setHexRGB(hexNumber);
|
|
426
425
|
}
|
|
427
426
|
else if (hex.length === 8) {
|
|
428
427
|
const hexNumber = parseInt(hex, 16);
|
|
429
428
|
if (isNaN(hexNumber)) {
|
|
430
|
-
throw new Error(`UIColor.setHexString.hexString: invalid hex string
|
|
429
|
+
throw new Error(`UIColor.setHexString.hexString: invalid hex string "${hexString}", expected "#ffffff" or "#ffffffff"`);
|
|
431
430
|
}
|
|
432
431
|
return this.setHexRGBA(hexNumber);
|
|
433
432
|
}
|
|
434
433
|
else {
|
|
435
|
-
throw new Error(`UIColor.setHexString.hexString: invalid hex string
|
|
434
|
+
throw new Error(`UIColor.setHexString.hexString: invalid hex string "${hexString}", expected "#ffffff" or "#ffffffff"`);
|
|
436
435
|
}
|
|
437
436
|
}
|
|
438
437
|
/** Sets from HSL values */
|
|
439
|
-
setHSL(h, s, l, a = this.
|
|
438
|
+
setHSL(h, s, l, a = this.aInternal) {
|
|
440
439
|
assertValidNumber(h, "UIColor.setHSL.h");
|
|
441
440
|
assertValidNumber(s, "UIColor.setHSL.s");
|
|
442
441
|
assertValidNumber(l, "UIColor.setHSL.l");
|
|
@@ -445,17 +444,17 @@ class UIColor {
|
|
|
445
444
|
s = MathUtils.clamp(s, 0, 1);
|
|
446
445
|
l = MathUtils.clamp(l, 0, 1);
|
|
447
446
|
a = MathUtils.clamp(a, 0, 1);
|
|
448
|
-
this.
|
|
449
|
-
if (h !== this.
|
|
450
|
-
s !== this.
|
|
451
|
-
l !== this.
|
|
452
|
-
a !== this.
|
|
453
|
-
this.
|
|
454
|
-
this.
|
|
455
|
-
this.
|
|
456
|
-
this.
|
|
457
|
-
this.
|
|
458
|
-
this.
|
|
447
|
+
this.ensureHSLUpdatedFromRGB();
|
|
448
|
+
if (h !== this.hInternal ||
|
|
449
|
+
s !== this.sInternal ||
|
|
450
|
+
l !== this.lInternal ||
|
|
451
|
+
a !== this.aInternal) {
|
|
452
|
+
this.hInternal = h;
|
|
453
|
+
this.sInternal = s;
|
|
454
|
+
this.lInternal = l;
|
|
455
|
+
this.aInternal = a;
|
|
456
|
+
this.rgbDirty = true;
|
|
457
|
+
this.dirtyInternal = true;
|
|
459
458
|
}
|
|
460
459
|
return this;
|
|
461
460
|
}
|
|
@@ -464,125 +463,125 @@ class UIColor {
|
|
|
464
463
|
*
|
|
465
464
|
* @throws If color name unknown
|
|
466
465
|
*/
|
|
467
|
-
setColorName(colorName, a = this.
|
|
466
|
+
setColorName(colorName, a = this.aInternal) {
|
|
468
467
|
assertValidNumber(a, "UIColor.setColorName.a");
|
|
469
468
|
a = MathUtils.clamp(a, 0, 1);
|
|
470
469
|
const normalizedName = colorName.toLowerCase().trim();
|
|
471
470
|
const hex = COLORS[normalizedName];
|
|
472
471
|
if (hex === undefined) {
|
|
473
|
-
throw new Error(`UIColor.setColorName.colorName: unknown color name`);
|
|
472
|
+
throw new Error(`UIColor.setColorName.colorName: unknown color name "${colorName}"`);
|
|
474
473
|
}
|
|
475
474
|
return this.setHexRGB(hex, a);
|
|
476
475
|
}
|
|
477
476
|
/** Sets from linear (GLSL) color space */
|
|
478
|
-
setGLSLColor(r, g, b, a = this.
|
|
477
|
+
setGLSLColor(r, g, b, a = this.aInternal) {
|
|
479
478
|
assertValidNumber(r, "UIColor.setGLSLColor.r");
|
|
480
479
|
assertValidNumber(g, "UIColor.setGLSLColor.g");
|
|
481
480
|
assertValidNumber(b, "UIColor.setGLSLColor.b");
|
|
482
481
|
assertValidNumber(a, "UIColor.setGLSLColor.a");
|
|
483
482
|
a = MathUtils.clamp(a, 0, 1);
|
|
484
|
-
this.
|
|
483
|
+
this.ensureRGBUpdatedFromHSL();
|
|
485
484
|
const sRGBR = linearToSRGB(r);
|
|
486
485
|
const sRGBG = linearToSRGB(g);
|
|
487
486
|
const sRGBB = linearToSRGB(b);
|
|
488
|
-
if (sRGBR !== this.
|
|
489
|
-
sRGBG !== this.
|
|
490
|
-
sRGBB !== this.
|
|
491
|
-
a !== this.
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
494
|
-
this.
|
|
495
|
-
this.
|
|
496
|
-
this.
|
|
497
|
-
this.
|
|
487
|
+
if (sRGBR !== this.rInternal ||
|
|
488
|
+
sRGBG !== this.gInternal ||
|
|
489
|
+
sRGBB !== this.bInternal ||
|
|
490
|
+
a !== this.aInternal) {
|
|
491
|
+
this.rInternal = sRGBR;
|
|
492
|
+
this.gInternal = sRGBG;
|
|
493
|
+
this.bInternal = sRGBB;
|
|
494
|
+
this.aInternal = a;
|
|
495
|
+
this.hslDirty = true;
|
|
496
|
+
this.dirtyInternal = true;
|
|
498
497
|
}
|
|
499
498
|
return this;
|
|
500
499
|
}
|
|
501
500
|
/** Sets from Three.js Color */
|
|
502
|
-
setThreeColor(threeColor, a = this.
|
|
501
|
+
setThreeColor(threeColor, a = this.aInternal) {
|
|
503
502
|
assertValidNumber(a, "UIColor.setThreeColor.a");
|
|
504
503
|
a = MathUtils.clamp(a, 0, 1);
|
|
505
|
-
this.
|
|
506
|
-
if (threeColor.r !== this.
|
|
507
|
-
threeColor.g !== this.
|
|
508
|
-
threeColor.b !== this.
|
|
509
|
-
a !== this.
|
|
510
|
-
this.
|
|
511
|
-
this.
|
|
512
|
-
this.
|
|
513
|
-
this.
|
|
514
|
-
this.
|
|
515
|
-
this.
|
|
504
|
+
this.ensureRGBUpdatedFromHSL();
|
|
505
|
+
if (threeColor.r !== this.rInternal ||
|
|
506
|
+
threeColor.g !== this.gInternal ||
|
|
507
|
+
threeColor.b !== this.bInternal ||
|
|
508
|
+
a !== this.aInternal) {
|
|
509
|
+
this.rInternal = threeColor.r;
|
|
510
|
+
this.gInternal = threeColor.g;
|
|
511
|
+
this.bInternal = threeColor.b;
|
|
512
|
+
this.aInternal = a;
|
|
513
|
+
this.hslDirty = true;
|
|
514
|
+
this.dirtyInternal = true;
|
|
516
515
|
}
|
|
517
516
|
return this;
|
|
518
517
|
}
|
|
519
518
|
/** Returns CSS color string ("rgba(255, 0, 0, 1)") */
|
|
520
519
|
toCSSColor() {
|
|
521
|
-
this.
|
|
522
|
-
const r = Math.round(this.
|
|
523
|
-
const g = Math.round(this.
|
|
524
|
-
const b = Math.round(this.
|
|
525
|
-
return `rgba(${r}, ${g}, ${b}, ${this.
|
|
520
|
+
this.ensureRGBUpdatedFromHSL();
|
|
521
|
+
const r = Math.round(this.rInternal * 255);
|
|
522
|
+
const g = Math.round(this.gInternal * 255);
|
|
523
|
+
const b = Math.round(this.bInternal * 255);
|
|
524
|
+
return `rgba(${r}, ${g}, ${b}, ${this.aInternal})`;
|
|
526
525
|
}
|
|
527
526
|
/** Converts to linear (GLSL) color space */
|
|
528
527
|
toGLSLColor(result = new Vector4()) {
|
|
529
|
-
this.
|
|
530
|
-
result.x = srgbToLinear(this.
|
|
531
|
-
result.y = srgbToLinear(this.
|
|
532
|
-
result.z = srgbToLinear(this.
|
|
533
|
-
result.w = this.
|
|
528
|
+
this.ensureRGBUpdatedFromHSL();
|
|
529
|
+
result.x = srgbToLinear(this.rInternal);
|
|
530
|
+
result.y = srgbToLinear(this.gInternal);
|
|
531
|
+
result.z = srgbToLinear(this.bInternal);
|
|
532
|
+
result.w = this.aInternal;
|
|
534
533
|
return result;
|
|
535
534
|
}
|
|
536
535
|
/** Converts to Three.js Color (without alpha) */
|
|
537
536
|
toThreeColor(result = new Color()) {
|
|
538
|
-
this.
|
|
539
|
-
result.r = this.
|
|
540
|
-
result.g = this.
|
|
541
|
-
result.b = this.
|
|
537
|
+
this.ensureRGBUpdatedFromHSL();
|
|
538
|
+
result.r = this.rInternal;
|
|
539
|
+
result.g = this.gInternal;
|
|
540
|
+
result.b = this.bInternal;
|
|
542
541
|
return result;
|
|
543
542
|
}
|
|
544
543
|
/** Copies from another color */
|
|
545
544
|
copy(color) {
|
|
546
545
|
if (color instanceof UIColor) {
|
|
547
|
-
this.
|
|
548
|
-
color.
|
|
549
|
-
if (this.
|
|
550
|
-
this.
|
|
551
|
-
this.
|
|
552
|
-
this.
|
|
553
|
-
this.
|
|
554
|
-
this.
|
|
555
|
-
this.
|
|
556
|
-
this.
|
|
557
|
-
this.
|
|
558
|
-
this.
|
|
546
|
+
this.ensureRGBUpdatedFromHSL();
|
|
547
|
+
color.ensureRGBUpdatedFromHSL();
|
|
548
|
+
if (this.rInternal !== color.rInternal ||
|
|
549
|
+
this.gInternal !== color.gInternal ||
|
|
550
|
+
this.bInternal !== color.bInternal ||
|
|
551
|
+
this.aInternal !== color.aInternal) {
|
|
552
|
+
this.rInternal = color.rInternal;
|
|
553
|
+
this.gInternal = color.gInternal;
|
|
554
|
+
this.bInternal = color.bInternal;
|
|
555
|
+
this.aInternal = color.aInternal;
|
|
556
|
+
this.hslDirty = true;
|
|
557
|
+
this.dirtyInternal = true;
|
|
559
558
|
}
|
|
560
559
|
}
|
|
561
560
|
else {
|
|
562
|
-
this.
|
|
563
|
-
if (this.
|
|
564
|
-
this.
|
|
565
|
-
this.
|
|
566
|
-
this.
|
|
567
|
-
this.
|
|
568
|
-
this.
|
|
569
|
-
this.
|
|
570
|
-
this.
|
|
571
|
-
this.
|
|
572
|
-
this.
|
|
561
|
+
this.ensureRGBUpdatedFromHSL();
|
|
562
|
+
if (this.rInternal !== color.r ||
|
|
563
|
+
this.gInternal !== color.g ||
|
|
564
|
+
this.bInternal !== color.b ||
|
|
565
|
+
this.aInternal !== 1) {
|
|
566
|
+
this.rInternal = color.r;
|
|
567
|
+
this.gInternal = color.g;
|
|
568
|
+
this.bInternal = color.b;
|
|
569
|
+
this.aInternal = 1;
|
|
570
|
+
this.hslDirty = true;
|
|
571
|
+
this.dirtyInternal = true;
|
|
573
572
|
}
|
|
574
573
|
}
|
|
575
574
|
return this;
|
|
576
575
|
}
|
|
577
576
|
/** Returns copy of this color */
|
|
578
577
|
clone() {
|
|
579
|
-
this.
|
|
580
|
-
return new UIColor(this.
|
|
578
|
+
this.ensureRGBUpdatedFromHSL();
|
|
579
|
+
return new UIColor(this.rInternal, this.gInternal, this.bInternal, this.aInternal);
|
|
581
580
|
}
|
|
582
581
|
/** @internal */
|
|
583
|
-
|
|
584
|
-
if (this.
|
|
585
|
-
const {
|
|
582
|
+
ensureRGBUpdatedFromHSL() {
|
|
583
|
+
if (this.rgbDirty) {
|
|
584
|
+
const { hInternal: h, sInternal: s, lInternal: l } = this;
|
|
586
585
|
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
587
586
|
const hp = h / 60;
|
|
588
587
|
const x = c * (1 - Math.abs((hp % 2) - 1));
|
|
@@ -598,15 +597,15 @@ class UIColor {
|
|
|
598
597
|
? [x, 0, c]
|
|
599
598
|
: [c, 0, x];
|
|
600
599
|
const m = l - c / 2;
|
|
601
|
-
this.
|
|
602
|
-
this.
|
|
603
|
-
this.
|
|
604
|
-
this.
|
|
600
|
+
this.rInternal = r + m;
|
|
601
|
+
this.gInternal = g + m;
|
|
602
|
+
this.bInternal = b + m;
|
|
603
|
+
this.rgbDirty = false;
|
|
605
604
|
}
|
|
606
605
|
}
|
|
607
|
-
|
|
608
|
-
if (this.
|
|
609
|
-
const {
|
|
606
|
+
ensureHSLUpdatedFromRGB() {
|
|
607
|
+
if (this.hslDirty) {
|
|
608
|
+
const { rInternal: r, gInternal: g, bInternal: b } = this;
|
|
610
609
|
const max = Math.max(r, g, b);
|
|
611
610
|
const min = Math.min(r, g, b);
|
|
612
611
|
const d = max - min;
|
|
@@ -625,12 +624,10 @@ class UIColor {
|
|
|
625
624
|
h *= 60;
|
|
626
625
|
}
|
|
627
626
|
const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
|
|
628
|
-
this.
|
|
629
|
-
this.
|
|
630
|
-
this.
|
|
631
|
-
this.
|
|
627
|
+
this.hInternal = h;
|
|
628
|
+
this.sInternal = s;
|
|
629
|
+
this.lInternal = l;
|
|
630
|
+
this.hslDirty = false;
|
|
632
631
|
}
|
|
633
632
|
}
|
|
634
633
|
}
|
|
635
|
-
|
|
636
|
-
export { UIColor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Matrix4 } from "three";
|
|
2
|
-
import { UIMicroAnchorMode } from "../miscellaneous/micro/UIMicro.Internal";
|
|
2
|
+
import { UIMicroAnchorMode } from "../miscellaneous/micro/UIMicro.Internal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Computes element transform matrix.
|
|
5
5
|
* @returns Transform matrix (reused, do not store reference)
|