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,93 @@
|
|
|
1
|
+
import { Mesh, InstancedBufferAttribute, StreamDrawUsage } from 'three';
|
|
2
|
+
import { resolvePropertyUniform } from '../../core/miscellaneous/generic-plane/shared.js';
|
|
3
|
+
import { BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME } from '../miscellaneous/miscellaneous.js';
|
|
4
|
+
import { INSTANCED_PARTICLE_GEOMETRY, buildParticleMaterial } from './UIInstancedParticle.Internal.js';
|
|
5
|
+
|
|
6
|
+
class UIInstancedParticle extends Mesh {
|
|
7
|
+
constructor(sources, uniforms, varyings, expectedCapacity, _private_capacityStep) {
|
|
8
|
+
const instancedGeometry = INSTANCED_PARTICLE_GEOMETRY.clone();
|
|
9
|
+
const shaderMaterial = buildParticleMaterial(sources, uniforms, varyings);
|
|
10
|
+
super(instancedGeometry, shaderMaterial);
|
|
11
|
+
this._private_capacityStep = _private_capacityStep;
|
|
12
|
+
this.propertyBuffers = {};
|
|
13
|
+
this.frustumCulled = false;
|
|
14
|
+
this.matrixAutoUpdate = false;
|
|
15
|
+
this.matrixWorldAutoUpdate = false;
|
|
16
|
+
this._private_instancedGeometry = instancedGeometry;
|
|
17
|
+
this._private_instancedGeometry.instanceCount = 0;
|
|
18
|
+
this._private_shaderMaterial = shaderMaterial;
|
|
19
|
+
this._private_capacity = Math.max(Math.ceil(expectedCapacity / this._private_capacityStep) * this._private_capacityStep, this._private_capacityStep);
|
|
20
|
+
for (const name in varyings) {
|
|
21
|
+
const { bufferSize } = varyings[name];
|
|
22
|
+
const attribute = new InstancedBufferAttribute(new Float32Array(this._private_capacity * bufferSize), bufferSize);
|
|
23
|
+
attribute.setUsage(StreamDrawUsage);
|
|
24
|
+
this._private_instancedGeometry.setAttribute(`a_${name}`, attribute);
|
|
25
|
+
this.propertyBuffers[name] = attribute;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
get instanceCount() {
|
|
29
|
+
return this._private_instancedGeometry.instanceCount;
|
|
30
|
+
}
|
|
31
|
+
createInstances(count) {
|
|
32
|
+
const currentInstanceCount = this._private_instancedGeometry.instanceCount;
|
|
33
|
+
this._private_ensureCapacity(currentInstanceCount + count);
|
|
34
|
+
this._private_instancedGeometry.instanceCount += count;
|
|
35
|
+
}
|
|
36
|
+
setOrigin(x, y) {
|
|
37
|
+
const uniform = resolvePropertyUniform("origin", this._private_shaderMaterial);
|
|
38
|
+
uniform.value.set(x, y);
|
|
39
|
+
}
|
|
40
|
+
removeDeadParticles() {
|
|
41
|
+
const builtinBuffer = this.propertyBuffers.builtin;
|
|
42
|
+
if (builtinBuffer === undefined) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const { array: builtinArray, itemSize: builtinItemSize } = builtinBuffer;
|
|
46
|
+
const { instanceCount } = this._private_instancedGeometry;
|
|
47
|
+
let writeIndex = 0;
|
|
48
|
+
for (let readIndex = 0; readIndex < instanceCount; readIndex++) {
|
|
49
|
+
const offset = readIndex * builtinItemSize;
|
|
50
|
+
if (builtinArray[offset + BUILTIN_OFFSET_AGE] < builtinArray[offset + BUILTIN_OFFSET_LIFETIME]) {
|
|
51
|
+
if (writeIndex !== readIndex) {
|
|
52
|
+
for (const name in this.propertyBuffers) {
|
|
53
|
+
const attribute = this.propertyBuffers[name];
|
|
54
|
+
const { itemSize: dataItemSize, array: dataArray } = attribute;
|
|
55
|
+
const srcOffset = readIndex * dataItemSize;
|
|
56
|
+
const dstOffset = writeIndex * dataItemSize;
|
|
57
|
+
dataArray.copyWithin(dstOffset, srcOffset, srcOffset + dataItemSize);
|
|
58
|
+
attribute.needsUpdate = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
writeIndex++;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
this._private_instancedGeometry.instanceCount = writeIndex;
|
|
65
|
+
}
|
|
66
|
+
drop() {
|
|
67
|
+
this._private_instancedGeometry.instanceCount = 0;
|
|
68
|
+
}
|
|
69
|
+
destroy() {
|
|
70
|
+
this._private_instancedGeometry.dispose();
|
|
71
|
+
this._private_shaderMaterial.dispose();
|
|
72
|
+
}
|
|
73
|
+
_private_ensureCapacity(requiredCapacity) {
|
|
74
|
+
if (requiredCapacity <= this._private_capacity) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const newCapacity = Math.ceil(requiredCapacity / this._private_capacityStep) * this._private_capacityStep;
|
|
78
|
+
for (const name in this.propertyBuffers) {
|
|
79
|
+
const { itemSize, array, usage } = this.propertyBuffers[name];
|
|
80
|
+
const newArray = new Float32Array(newCapacity * itemSize);
|
|
81
|
+
newArray.set(array);
|
|
82
|
+
const newAttribute = new InstancedBufferAttribute(newArray, itemSize);
|
|
83
|
+
newAttribute.setUsage(usage);
|
|
84
|
+
this._private_instancedGeometry.setAttribute(`a_${name}`, newAttribute);
|
|
85
|
+
this.propertyBuffers[name] = newAttribute;
|
|
86
|
+
}
|
|
87
|
+
this._private_capacity = newCapacity;
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- old three.js compatibility fix
|
|
89
|
+
this._private_instancedGeometry._maxInstanceCount = newCapacity;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { UIInstancedParticle };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DataTexture, type Vector2Tuple } from "three";
|
|
2
|
+
import type { UIColor } from "../../core";
|
|
3
|
+
import type { Vector2Like } from "../../core/miscellaneous/math";
|
|
4
|
+
import type { UITextureConfig } from "../../core/miscellaneous/texture/UITextureView.Internal";
|
|
5
|
+
export interface UIRange {
|
|
6
|
+
min: number;
|
|
7
|
+
max: number;
|
|
8
|
+
}
|
|
9
|
+
export type UIRangeConfig = UIRange | [number, number] | number;
|
|
10
|
+
export type UIVector2Config = Vector2Like | Vector2Tuple | number;
|
|
11
|
+
export type UIAspectConfig = number | UITextureConfig;
|
|
12
|
+
export declare function resolveUIRangeConfig(config: UIRangeConfig): UIRange;
|
|
13
|
+
export declare function resolveUIVector2Config(config: UIVector2Config): Vector2Like;
|
|
14
|
+
export declare function resolveAspect(config: number | UITextureConfig): number;
|
|
15
|
+
export declare function generateNoise2D(x: number, y: number): number;
|
|
16
|
+
export declare function buildGradientTexture(colors: UIColor[]): DataTexture;
|
|
17
|
+
export declare const BUILTIN_OFFSET_POSITION_X = 0;
|
|
18
|
+
export declare const BUILTIN_OFFSET_POSITION_Y = 1;
|
|
19
|
+
export declare const BUILTIN_OFFSET_VELOCITY_X = 2;
|
|
20
|
+
export declare const BUILTIN_OFFSET_VELOCITY_Y = 3;
|
|
21
|
+
export declare const BUILTIN_OFFSET_SCALE_X = 4;
|
|
22
|
+
export declare const BUILTIN_OFFSET_SCALE_Y = 5;
|
|
23
|
+
export declare const BUILTIN_OFFSET_ROTATION = 6;
|
|
24
|
+
export declare const BUILTIN_OFFSET_TORQUE = 7;
|
|
25
|
+
export declare const BUILTIN_OFFSET_LIFETIME = 8;
|
|
26
|
+
export declare const BUILTIN_OFFSET_AGE = 9;
|
|
27
|
+
export declare const BUILTIN_OFFSET_RANDOM_A = 10;
|
|
28
|
+
export declare const BUILTIN_OFFSET_RANDOM_B = 11;
|
|
29
|
+
export declare const BUILTIN_OFFSET_RANDOM_C = 12;
|
|
30
|
+
export declare const BUILTIN_OFFSET_RANDOM_D = 13;
|
|
31
|
+
export declare const BUILTIN_OFFSET_RANDOM_E = 14;
|
|
32
|
+
export declare const BUILTIN_OFFSET_RANDOM_F = 15;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Texture, DataTexture, RGBAFormat, UnsignedByteType, UVMapping, ClampToEdgeWrapping, LinearFilter, SRGBColorSpace } from 'three';
|
|
2
|
+
|
|
3
|
+
function resolveUIRangeConfig(config) {
|
|
4
|
+
if (typeof config === "number") {
|
|
5
|
+
return { min: config, max: config };
|
|
6
|
+
}
|
|
7
|
+
if (Array.isArray(config)) {
|
|
8
|
+
return { min: config[0], max: config[1] };
|
|
9
|
+
}
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
function resolveUIVector2Config(config) {
|
|
13
|
+
if (typeof config === "number") {
|
|
14
|
+
return { x: config, y: config };
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(config)) {
|
|
17
|
+
return { x: config[0], y: config[1] };
|
|
18
|
+
}
|
|
19
|
+
return config;
|
|
20
|
+
}
|
|
21
|
+
function resolveAspect(config) {
|
|
22
|
+
if (typeof config === "number") {
|
|
23
|
+
return config;
|
|
24
|
+
}
|
|
25
|
+
if (config instanceof Texture) {
|
|
26
|
+
return config.image.naturalWidth / config.image.naturalHeight;
|
|
27
|
+
}
|
|
28
|
+
return config.sourceSize.w / config.sourceSize.h;
|
|
29
|
+
}
|
|
30
|
+
function generateNoise2D(x, y) {
|
|
31
|
+
const noise = Math.sin(x * 12.9898 + y * 78.233) * 43758.5453123;
|
|
32
|
+
return (noise - Math.floor(noise)) * 2 - 1;
|
|
33
|
+
}
|
|
34
|
+
function buildGradientTexture(colors) {
|
|
35
|
+
const width = colors.length;
|
|
36
|
+
const height = 1;
|
|
37
|
+
const data = new Uint8Array(width * height * 4);
|
|
38
|
+
for (let i = 0; i < width; i++) {
|
|
39
|
+
const color = colors[i];
|
|
40
|
+
const index = i * 4;
|
|
41
|
+
data[index] = Math.round(color.r * 255);
|
|
42
|
+
data[index + 1] = Math.round(color.g * 255);
|
|
43
|
+
data[index + 2] = Math.round(color.b * 255);
|
|
44
|
+
data[index + 3] = Math.round(color.a * 255);
|
|
45
|
+
}
|
|
46
|
+
const texture = new DataTexture(data, width, height, RGBAFormat, UnsignedByteType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, LinearFilter, 1, SRGBColorSpace);
|
|
47
|
+
texture.needsUpdate = true;
|
|
48
|
+
return texture;
|
|
49
|
+
}
|
|
50
|
+
const BUILTIN_OFFSET_POSITION_X = 0;
|
|
51
|
+
const BUILTIN_OFFSET_POSITION_Y = 1;
|
|
52
|
+
const BUILTIN_OFFSET_VELOCITY_X = 2;
|
|
53
|
+
const BUILTIN_OFFSET_VELOCITY_Y = 3;
|
|
54
|
+
const BUILTIN_OFFSET_SCALE_X = 4;
|
|
55
|
+
const BUILTIN_OFFSET_SCALE_Y = 5;
|
|
56
|
+
const BUILTIN_OFFSET_ROTATION = 6;
|
|
57
|
+
const BUILTIN_OFFSET_TORQUE = 7;
|
|
58
|
+
const BUILTIN_OFFSET_LIFETIME = 8;
|
|
59
|
+
const BUILTIN_OFFSET_AGE = 9;
|
|
60
|
+
const BUILTIN_OFFSET_RANDOM_A = 10;
|
|
61
|
+
const BUILTIN_OFFSET_RANDOM_B = 11;
|
|
62
|
+
const BUILTIN_OFFSET_RANDOM_C = 12;
|
|
63
|
+
const BUILTIN_OFFSET_RANDOM_D = 13;
|
|
64
|
+
const BUILTIN_OFFSET_RANDOM_E = 14;
|
|
65
|
+
const BUILTIN_OFFSET_RANDOM_F = 15;
|
|
66
|
+
|
|
67
|
+
export { BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_D, BUILTIN_OFFSET_RANDOM_E, BUILTIN_OFFSET_RANDOM_F, BUILTIN_OFFSET_ROTATION, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y, BUILTIN_OFFSET_TORQUE, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, buildGradientTexture, generateNoise2D, resolveAspect, resolveUIRangeConfig, resolveUIVector2Config };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UIColor } from "../../core";
|
|
2
|
+
import { UIRenderingModule } from "./UIRenderingModule";
|
|
3
|
+
/**
|
|
4
|
+
* Colors particles based on lifetime progression.
|
|
5
|
+
*
|
|
6
|
+
* Interpolates through color gradient as particles age from birth to death.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UIRenderingColorOverLife extends UIRenderingModule {
|
|
9
|
+
/**
|
|
10
|
+
* @param colors - Color gradient stops from birth to death
|
|
11
|
+
*/
|
|
12
|
+
constructor(colors: UIColor[]);
|
|
13
|
+
destroy(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { buildGradientTexture } from '../miscellaneous/miscellaneous.js';
|
|
2
|
+
import source from '../shaders/UIRenderingColorOverLife.glsl.js';
|
|
3
|
+
import { UIRenderingModule } from './UIRenderingModule.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Colors particles based on lifetime progression.
|
|
7
|
+
*
|
|
8
|
+
* Interpolates through color gradient as particles age from birth to death.
|
|
9
|
+
*/
|
|
10
|
+
class UIRenderingColorOverLife extends UIRenderingModule {
|
|
11
|
+
/**
|
|
12
|
+
* @param colors - Color gradient stops from birth to death
|
|
13
|
+
*/
|
|
14
|
+
constructor(colors) {
|
|
15
|
+
super();
|
|
16
|
+
/** @internal */
|
|
17
|
+
this.requiredProperties = {
|
|
18
|
+
builtin: "Matrix4",
|
|
19
|
+
};
|
|
20
|
+
/** @internal */
|
|
21
|
+
this.source = source;
|
|
22
|
+
if (colors.length === 0) {
|
|
23
|
+
throw new Error("UIRenderingColorOverLife: colors array cannot be empty");
|
|
24
|
+
}
|
|
25
|
+
this.requiredUniforms = { colorOverLifeTexture: buildGradientTexture(colors) };
|
|
26
|
+
}
|
|
27
|
+
destroy() {
|
|
28
|
+
this.requiredUniforms.colorOverLifeTexture.dispose();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { UIRenderingColorOverLife };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UIColor } from "../../core";
|
|
2
|
+
import { UIRenderingModule } from "./UIRenderingModule";
|
|
3
|
+
/**
|
|
4
|
+
* Colors particles based on velocity magnitude.
|
|
5
|
+
*
|
|
6
|
+
* Maps velocity from 0 to maxVelocity across the color gradient.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UIRenderingColorOverVelocity extends UIRenderingModule {
|
|
9
|
+
/**
|
|
10
|
+
* @param colors - Color gradient from slow to fast
|
|
11
|
+
* @param maxVelocity - Velocity mapped to final color
|
|
12
|
+
*/
|
|
13
|
+
constructor(colors: UIColor[], maxVelocity: number);
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { buildGradientTexture } from '../miscellaneous/miscellaneous.js';
|
|
2
|
+
import source from '../shaders/UIRenderingColorOverVelocity.glsl.js';
|
|
3
|
+
import { UIRenderingModule } from './UIRenderingModule.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Colors particles based on velocity magnitude.
|
|
7
|
+
*
|
|
8
|
+
* Maps velocity from 0 to maxVelocity across the color gradient.
|
|
9
|
+
*/
|
|
10
|
+
class UIRenderingColorOverVelocity extends UIRenderingModule {
|
|
11
|
+
/**
|
|
12
|
+
* @param colors - Color gradient from slow to fast
|
|
13
|
+
* @param maxVelocity - Velocity mapped to final color
|
|
14
|
+
*/
|
|
15
|
+
constructor(colors, maxVelocity) {
|
|
16
|
+
super();
|
|
17
|
+
/** @internal */
|
|
18
|
+
this.requiredProperties = {
|
|
19
|
+
builtin: "Matrix4",
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
this.source = source;
|
|
23
|
+
if (colors.length === 0) {
|
|
24
|
+
throw new Error("UIRenderingColorOverVelocity: colors array cannot be empty");
|
|
25
|
+
}
|
|
26
|
+
if (maxVelocity <= 0) {
|
|
27
|
+
throw new Error("UIRenderingColorOverVelocity: maxVelocity must be greater than 0");
|
|
28
|
+
}
|
|
29
|
+
this.source = source.replace("COLOR_OVER_VELOCITY_MAX", `COLOR_OVER_VELOCITY_MAX ${maxVelocity.toFixed(2)}`);
|
|
30
|
+
this.requiredUniforms = { colorOverVelocityTexture: buildGradientTexture(colors) };
|
|
31
|
+
}
|
|
32
|
+
destroy() {
|
|
33
|
+
this.requiredUniforms.colorOverVelocityTexture.dispose();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { UIRenderingColorOverVelocity };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UITextureConfig } from "../../core/miscellaneous/texture/UITextureView.Internal";
|
|
2
|
+
import { UIRenderingModule } from "./UIRenderingModule";
|
|
3
|
+
/**
|
|
4
|
+
* Renders particles with a texture.
|
|
5
|
+
*
|
|
6
|
+
* Samples the texture using particle UV coordinates.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UITextureRenderingModule extends UIRenderingModule {
|
|
9
|
+
private readonly texture;
|
|
10
|
+
/**
|
|
11
|
+
* @param config - Texture configuration
|
|
12
|
+
*/
|
|
13
|
+
constructor(config: UITextureConfig);
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { UITextureView } from '../../core/miscellaneous/texture/UITextureView.js';
|
|
2
|
+
import source from '../shaders/UIRenderingTexture.glsl.js';
|
|
3
|
+
import { UIRenderingModule } from './UIRenderingModule.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Renders particles with a texture.
|
|
7
|
+
*
|
|
8
|
+
* Samples the texture using particle UV coordinates.
|
|
9
|
+
*/
|
|
10
|
+
class UITextureRenderingModule extends UIRenderingModule {
|
|
11
|
+
/**
|
|
12
|
+
* @param config - Texture configuration
|
|
13
|
+
*/
|
|
14
|
+
constructor(config) {
|
|
15
|
+
super();
|
|
16
|
+
/** @internal */
|
|
17
|
+
this.source = source;
|
|
18
|
+
this._private_texture = new UITextureView(config);
|
|
19
|
+
this.requiredUniforms = {
|
|
20
|
+
texture: this._private_texture.texture,
|
|
21
|
+
textureTransform: this._private_texture.calculateUVTransform(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { UITextureRenderingModule };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UIPropertyName } from "../../core/miscellaneous/generic-plane/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for particle spawn modules.
|
|
4
|
+
*
|
|
5
|
+
* Spawn modules initialize particle properties when particles are created.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class UISpawnModule<T extends Record<string, UIPropertyName> = Record<string, UIPropertyName>> {
|
|
8
|
+
destroy?(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Vector2Like } from "../../core/miscellaneous/math";
|
|
2
|
+
import { type UIVector2Config } from "../miscellaneous/miscellaneous";
|
|
3
|
+
import { UISpawnModule } from "./UISpawnModule";
|
|
4
|
+
/**
|
|
5
|
+
* Sets particle spawn position offset.
|
|
6
|
+
*
|
|
7
|
+
* All particles spawned with this module start at the specified position.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UISpawnOffset extends UISpawnModule<{
|
|
10
|
+
builtin: "Matrix4";
|
|
11
|
+
}> {
|
|
12
|
+
private offsetInternal;
|
|
13
|
+
/**
|
|
14
|
+
* @param offset - Initial particle position offset
|
|
15
|
+
*/
|
|
16
|
+
constructor(offset?: UIVector2Config);
|
|
17
|
+
/** Particle position offset */
|
|
18
|
+
get offset(): Vector2Like;
|
|
19
|
+
/** Particle position offset */
|
|
20
|
+
set offset(value: UIVector2Config);
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { assertValidNumber } from '../../core/miscellaneous/asserts.js';
|
|
2
|
+
import { resolveUIVector2Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y } from '../miscellaneous/miscellaneous.js';
|
|
3
|
+
import { UISpawnModule } from './UISpawnModule.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sets particle spawn position offset.
|
|
7
|
+
*
|
|
8
|
+
* All particles spawned with this module start at the specified position.
|
|
9
|
+
*/
|
|
10
|
+
class UISpawnOffset extends UISpawnModule {
|
|
11
|
+
/**
|
|
12
|
+
* @param offset - Initial particle position offset
|
|
13
|
+
*/
|
|
14
|
+
constructor(offset = { x: 0, y: 0 }) {
|
|
15
|
+
super();
|
|
16
|
+
/** @internal */
|
|
17
|
+
this.requiredProperties = { builtin: "Matrix4" };
|
|
18
|
+
this._private_offsetInternal = resolveUIVector2Config(offset);
|
|
19
|
+
assertValidNumber(this._private_offsetInternal.x, "UISpawnOffset.constructor.offset.x");
|
|
20
|
+
assertValidNumber(this._private_offsetInternal.y, "UISpawnOffset.constructor.offset.y");
|
|
21
|
+
}
|
|
22
|
+
/** Particle position offset */
|
|
23
|
+
get offset() {
|
|
24
|
+
return this._private_offsetInternal;
|
|
25
|
+
}
|
|
26
|
+
/** Particle position offset */
|
|
27
|
+
set offset(value) {
|
|
28
|
+
this._private_offsetInternal = resolveUIVector2Config(value);
|
|
29
|
+
assertValidNumber(this._private_offsetInternal.x, "UISpawnOffset.offset.x");
|
|
30
|
+
assertValidNumber(this._private_offsetInternal.y, "UISpawnOffset.offset.y");
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
spawn(properties, instanceBegin, instanceEnd) {
|
|
34
|
+
const { builtin } = properties;
|
|
35
|
+
const { array, itemSize } = builtin;
|
|
36
|
+
const { x: offsetX, y: offsetY } = this._private_offsetInternal;
|
|
37
|
+
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
38
|
+
const itemOffset = i * itemSize;
|
|
39
|
+
array[itemOffset + BUILTIN_OFFSET_POSITION_X] = offsetX;
|
|
40
|
+
array[itemOffset + BUILTIN_OFFSET_POSITION_Y] = offsetY;
|
|
41
|
+
}
|
|
42
|
+
builtin.needsUpdate = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { UISpawnOffset };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
|
+
import { UISpawnModule } from "./UISpawnModule";
|
|
3
|
+
/**
|
|
4
|
+
* Assigns random lifetime to particles.
|
|
5
|
+
*
|
|
6
|
+
* Lifetime is chosen uniformly from the specified range. Age is set to 0.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UISpawnRandomLifetime extends UISpawnModule<{
|
|
9
|
+
builtin: "Matrix4";
|
|
10
|
+
}> {
|
|
11
|
+
private lifetimeInternal;
|
|
12
|
+
/**
|
|
13
|
+
* @param lifetime - Lifetime range in seconds. Accepts number, tuple, or range object
|
|
14
|
+
*/
|
|
15
|
+
constructor(lifetime?: UIRangeConfig);
|
|
16
|
+
/** Lifetime range in seconds */
|
|
17
|
+
get lifetime(): UIRange;
|
|
18
|
+
/** Lifetime range in seconds */
|
|
19
|
+
set lifetime(value: UIRangeConfig);
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MathUtils } from 'three';
|
|
2
|
+
import { assertValidPositiveNumber } from '../../core/miscellaneous/asserts.js';
|
|
3
|
+
import { resolveUIRangeConfig, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_AGE } from '../miscellaneous/miscellaneous.js';
|
|
4
|
+
import { UISpawnModule } from './UISpawnModule.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Assigns random lifetime to particles.
|
|
8
|
+
*
|
|
9
|
+
* Lifetime is chosen uniformly from the specified range. Age is set to 0.
|
|
10
|
+
*/
|
|
11
|
+
class UISpawnRandomLifetime extends UISpawnModule {
|
|
12
|
+
/**
|
|
13
|
+
* @param lifetime - Lifetime range in seconds. Accepts number, tuple, or range object
|
|
14
|
+
*/
|
|
15
|
+
constructor(lifetime = { min: 4, max: 8 }) {
|
|
16
|
+
super();
|
|
17
|
+
/** @internal */
|
|
18
|
+
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
|
+
this._private_lifetimeInternal = resolveUIRangeConfig(lifetime);
|
|
20
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.min, "UISpawnRandomLifetime.constructor.lifetime.min");
|
|
21
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.max, "UISpawnRandomLifetime.constructor.lifetime.max");
|
|
22
|
+
}
|
|
23
|
+
/** Lifetime range in seconds */
|
|
24
|
+
get lifetime() {
|
|
25
|
+
return this._private_lifetimeInternal;
|
|
26
|
+
}
|
|
27
|
+
/** Lifetime range in seconds */
|
|
28
|
+
set lifetime(value) {
|
|
29
|
+
this._private_lifetimeInternal = resolveUIRangeConfig(value);
|
|
30
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.min, "UISpawnRandomLifetime.lifetime.min");
|
|
31
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.max, "UISpawnRandomLifetime.lifetime.max");
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
spawn(properties, instanceBegin, instanceEnd) {
|
|
35
|
+
const { builtin } = properties;
|
|
36
|
+
const { array, itemSize } = builtin;
|
|
37
|
+
const { min: lifetimeMin, max: lifetimeMax } = this._private_lifetimeInternal;
|
|
38
|
+
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
39
|
+
const itemOffset = i * itemSize;
|
|
40
|
+
array[itemOffset + BUILTIN_OFFSET_LIFETIME] = MathUtils.randFloat(lifetimeMin, lifetimeMax);
|
|
41
|
+
array[itemOffset + BUILTIN_OFFSET_AGE] = 0;
|
|
42
|
+
}
|
|
43
|
+
builtin.needsUpdate = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { UISpawnRandomLifetime };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type UIRange, type UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
|
+
import { UISpawnModule } from "./UISpawnModule";
|
|
3
|
+
/**
|
|
4
|
+
* Assigns random rotation to particles.
|
|
5
|
+
*
|
|
6
|
+
* Initial rotation is chosen uniformly from the specified range.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UISpawnRandomRotation extends UISpawnModule<{
|
|
9
|
+
builtin: "Matrix4";
|
|
10
|
+
}> {
|
|
11
|
+
private rotationInternal;
|
|
12
|
+
/**
|
|
13
|
+
* @param rotation - Rotation range in radians. Accepts number, tuple, or range object
|
|
14
|
+
*/
|
|
15
|
+
constructor(rotation?: UIRangeConfig);
|
|
16
|
+
/** Rotation range in radians */
|
|
17
|
+
get rotation(): UIRange;
|
|
18
|
+
/** Rotation range in radians */
|
|
19
|
+
set rotation(value: UIRangeConfig);
|
|
20
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MathUtils } from 'three';
|
|
2
|
+
import { assertValidNumber } from '../../core/miscellaneous/asserts.js';
|
|
3
|
+
import { resolveUIRangeConfig, BUILTIN_OFFSET_ROTATION } from '../miscellaneous/miscellaneous.js';
|
|
4
|
+
import { UISpawnModule } from './UISpawnModule.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Assigns random rotation to particles.
|
|
8
|
+
*
|
|
9
|
+
* Initial rotation is chosen uniformly from the specified range.
|
|
10
|
+
*/
|
|
11
|
+
class UISpawnRandomRotation extends UISpawnModule {
|
|
12
|
+
/**
|
|
13
|
+
* @param rotation - Rotation range in radians. Accepts number, tuple, or range object
|
|
14
|
+
*/
|
|
15
|
+
constructor(rotation = { min: -Math.PI, max: Math.PI }) {
|
|
16
|
+
super();
|
|
17
|
+
/** @internal */
|
|
18
|
+
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
|
+
this._private_rotationInternal = resolveUIRangeConfig(rotation);
|
|
20
|
+
assertValidNumber(this._private_rotationInternal.min, "UISpawnRandomRotation.constructor.rotation.min");
|
|
21
|
+
assertValidNumber(this._private_rotationInternal.max, "UISpawnRandomRotation.constructor.rotation.max");
|
|
22
|
+
}
|
|
23
|
+
/** Rotation range in radians */
|
|
24
|
+
get rotation() {
|
|
25
|
+
return this._private_rotationInternal;
|
|
26
|
+
}
|
|
27
|
+
/** Rotation range in radians */
|
|
28
|
+
set rotation(value) {
|
|
29
|
+
this._private_rotationInternal = resolveUIRangeConfig(value);
|
|
30
|
+
assertValidNumber(this._private_rotationInternal.min, "UISpawnRandomRotation.rotation.min");
|
|
31
|
+
assertValidNumber(this._private_rotationInternal.max, "UISpawnRandomRotation.rotation.max");
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
spawn(properties, instanceBegin, instanceEnd) {
|
|
35
|
+
const { builtin } = properties;
|
|
36
|
+
const { array, itemSize } = builtin;
|
|
37
|
+
const { min: rotationMin, max: rotationMax } = this._private_rotationInternal;
|
|
38
|
+
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
39
|
+
array[i * itemSize + BUILTIN_OFFSET_ROTATION] = MathUtils.randFloat(rotationMin, rotationMax);
|
|
40
|
+
}
|
|
41
|
+
builtin.needsUpdate = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { UISpawnRandomRotation };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type UIAspectConfig, type UIRange, type UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
|
+
import { UISpawnModule } from "./UISpawnModule";
|
|
3
|
+
/**
|
|
4
|
+
* Assigns random scale to particles.
|
|
5
|
+
*
|
|
6
|
+
* Base scale is chosen uniformly from the range. Aspect ratio is applied to X scale.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UISpawnRandomScale extends UISpawnModule<{
|
|
9
|
+
builtin: "Matrix4";
|
|
10
|
+
}> {
|
|
11
|
+
private scaleInternal;
|
|
12
|
+
private aspectInternal;
|
|
13
|
+
/**
|
|
14
|
+
* @param scale - Base scale range. Accepts number, tuple, or range object
|
|
15
|
+
* @param aspect - Width/height ratio. Accepts number or texture
|
|
16
|
+
*/
|
|
17
|
+
constructor(scale?: UIRangeConfig, aspect?: UIAspectConfig);
|
|
18
|
+
/** Base scale range */
|
|
19
|
+
get scale(): UIRange;
|
|
20
|
+
/** Width/height aspect ratio */
|
|
21
|
+
get aspect(): number;
|
|
22
|
+
/** Base scale range */
|
|
23
|
+
set scale(value: UIRangeConfig);
|
|
24
|
+
/** Width/height aspect ratio */
|
|
25
|
+
set aspect(value: UIAspectConfig);
|
|
26
|
+
}
|