laymur 0.19.0 → 0.19.2
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 +43 -16
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.js +4 -4
- package/dist/debug/UILayerDebug.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +1 -1
- package/dist/particles/elements/UIEmitter.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -2
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +1 -1
- package/dist/particles/miscellaneous/miscellaneous.d.ts +2 -1
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
|
-
* **Cassowary solver**
|
|
19
|
-
* **Orientation-aware**
|
|
20
|
-
* **Micro-transforms**
|
|
21
|
-
* **Resize policies**
|
|
22
|
-
* **Modular particles**
|
|
18
|
+
* **Cassowary solver** - constraint-based layouts via `@lume/kiwi`
|
|
19
|
+
* **Orientation-aware** - define portrait and landscape rules in one layout, solver toggles automatically
|
|
20
|
+
* **Micro-transforms** - visual-only transforms (scale, rotation, offset) that bypass the solver
|
|
21
|
+
* **Resize policies** - Cover, Fit, FixedHeight, FixedWidth, Cross strategies
|
|
22
|
+
* **Modular particles** - separate `laymur/particles` entry point, import only if needed
|
|
23
|
+
* **Debug overlay** - separate `laymur/debug` entry point, constraint visualization
|
|
23
24
|
|
|
24
25
|
## Installation
|
|
25
26
|
|
|
@@ -35,8 +36,12 @@ Peer Dependencies:
|
|
|
35
36
|
|
|
36
37
|
## Visual Editor & Live Examples
|
|
37
38
|
|
|
38
|
-
Check out visual editor and interactive examples at:
|
|
39
|
-
|
|
39
|
+
Check out visual editor and interactive examples at:
|
|
40
|
+
|
|
41
|
+
**[EDITOR](https://jango-git.github.io/laymur-docs/editor/index.html)**
|
|
42
|
+
|
|
43
|
+
**[EXAMPLES](https://jango-git.github.io/laymur/examples/index.html)**
|
|
44
|
+
|
|
40
45
|
|
|
41
46
|
## Core Concepts
|
|
42
47
|
|
|
@@ -93,7 +98,7 @@ new UIHorizontalProportionConstraint(layer, element, {
|
|
|
93
98
|
|
|
94
99
|
### 3. Micro-transforms
|
|
95
100
|
|
|
96
|
-
For animations, use `.micro`
|
|
101
|
+
For animations, use `.micro` - updates visual matrix without triggering the solver.
|
|
97
102
|
|
|
98
103
|
```typescript
|
|
99
104
|
element.micro.scaleX = Math.sin(Date.now() * 0.001) + 1;
|
|
@@ -118,6 +123,34 @@ const emitter = new UIEmitter(
|
|
|
118
123
|
emitter.play(60); // particles/sec
|
|
119
124
|
```
|
|
120
125
|
|
|
126
|
+
### 5. Debug Overlay
|
|
127
|
+
|
|
128
|
+
`laymur/debug` renders visual overlays for constraints - useful during development to inspect layout relationships.
|
|
129
|
+
|
|
130
|
+
`UILayerDebug` automatically tracks all constraints on a layer and creates the corresponding overlays. Individual constraint types can be toggled on/off.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { UILayerDebug } from 'laymur/debug';
|
|
134
|
+
|
|
135
|
+
const debug = new UILayerDebug(layer, {
|
|
136
|
+
showAspect: true,
|
|
137
|
+
showWidth: true,
|
|
138
|
+
showHeight: true,
|
|
139
|
+
showHorizontalDistance: true,
|
|
140
|
+
showVerticalDistance: true,
|
|
141
|
+
showHorizontalInterpolation: false,
|
|
142
|
+
showVerticalInterpolation: false,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Toggle a category at runtime
|
|
146
|
+
debug.showAspect = false;
|
|
147
|
+
|
|
148
|
+
// Clean up
|
|
149
|
+
debug.destroy();
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Overlays respect orientation - they hide automatically when their constraint's orientation is inactive.
|
|
153
|
+
|
|
121
154
|
## API Overview
|
|
122
155
|
|
|
123
156
|
Most commonly used exports (not exhaustive):
|
|
@@ -134,15 +167,9 @@ UIAspectConstraint, UIHorizontalDistanceConstraint, UIVerticalDistanceConstraint
|
|
|
134
167
|
|
|
135
168
|
UIEmitter, UISpawnRectangle, UISpawnRandomLifetime, UIBehaviorDirectionalGravity, UIBehaviorVelocityDamping, UIRenderingTexture, UIRenderingColorOverLife
|
|
136
169
|
|
|
137
|
-
|
|
170
|
+
### Debug (laymur/debug)
|
|
138
171
|
|
|
139
|
-
|
|
140
|
-
// package.json
|
|
141
|
-
"exports": {
|
|
142
|
-
".": "./dist/index.js",
|
|
143
|
-
"./particles": "./dist/particles/index.js"
|
|
144
|
-
}
|
|
145
|
-
```
|
|
172
|
+
UILayerDebug, UIAspectDebug, UIHeightDebug, UIWidthDebug, UIHorizontalDistanceDebug, UIVerticalDistanceDebug, UIHorizontalInterpolationDebug, UIVerticalInterpolationDebug
|
|
146
173
|
|
|
147
174
|
## License
|
|
148
175
|
|
|
@@ -44,7 +44,7 @@ export declare class UIGraphics extends UIElement {
|
|
|
44
44
|
* @param points - Array of [x, y] pairs
|
|
45
45
|
* @param lineWidth - Line width in pixels
|
|
46
46
|
*/
|
|
47
|
-
drawPolyline(points: [number, number][], color:
|
|
47
|
+
drawPolyline(points: [number, number][], color: UIColorConfig, lineWidth?: number): this;
|
|
48
48
|
/** Removes element and frees resources */
|
|
49
49
|
destroy(): void;
|
|
50
50
|
protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
|
|
@@ -367,10 +367,10 @@ class UIColor {
|
|
|
367
367
|
setHexRGBA(hex) {
|
|
368
368
|
assertValidNumber(hex, "UIColor.setHexRGBA.hex");
|
|
369
369
|
this._private_ensureRGBUpdatedFromHSL();
|
|
370
|
-
const r = ((hex >>
|
|
371
|
-
const g = ((hex >>
|
|
372
|
-
const b = (hex & 0xff) / 255;
|
|
373
|
-
const a = (
|
|
370
|
+
const r = ((hex >> 24) & 0xff) / 255;
|
|
371
|
+
const g = ((hex >> 16) & 0xff) / 255;
|
|
372
|
+
const b = ((hex >> 8) & 0xff) / 255;
|
|
373
|
+
const a = (hex & 0xff) / 255;
|
|
374
374
|
if (r !== this._private_rInternal ||
|
|
375
375
|
g !== this._private_gInternal ||
|
|
376
376
|
b !== this._private_bInternal ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Vector2Like } from "../../core/miscellaneous/math";
|
|
2
|
-
import {
|
|
2
|
+
import type { UIVector2Config } from "../miscellaneous/miscellaneous";
|
|
3
3
|
import { UIBehaviorModule } from "./UIBehaviorModule";
|
|
4
4
|
/**
|
|
5
5
|
* Applies constant acceleration to all particles.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UIAspectConfig, UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
2
|
import { UIBehaviorModule } from "./UIBehaviorModule";
|
|
3
3
|
/**
|
|
4
4
|
* Animates particle scale over lifetime.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
2
|
import { UIBehaviorModule } from "./UIBehaviorModule";
|
|
3
3
|
/**
|
|
4
4
|
* Reduces particle angular velocity over time.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
2
|
import { UIBehaviorModule } from "./UIBehaviorModule";
|
|
3
3
|
/**
|
|
4
4
|
* Applies noise-based angular acceleration to particles.
|
|
@@ -4,7 +4,7 @@ import type { UIAnchorOptions } from "../../core/elements/UIAnchor/UIAnchor.Inte
|
|
|
4
4
|
import type { UIBehaviorModule } from "../behaviorModules/UIBehaviorModule";
|
|
5
5
|
import type { UIRenderingModule } from "../renderingModules/UIRenderingModule";
|
|
6
6
|
import type { UISpawnModule } from "../spawnModules/UISpawnModule";
|
|
7
|
-
import {
|
|
7
|
+
import type { UIEmitterMode, UIEmitterPlayOptions } from "./UIEmitter.Internal";
|
|
8
8
|
export interface UIEmitterOptions extends UIAnchorOptions {
|
|
9
9
|
mode: UIEmitterMode;
|
|
10
10
|
expectedCapacity: number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { InstancedBufferGeometry, ShaderMaterial } from "three";
|
|
2
|
-
import type { GLProperty, GLTypeInfo } from "../../core/miscellaneous/generic-plane/shared";
|
|
3
|
-
import { type UIProperty, type UIPropertyName } from "../../core/miscellaneous/generic-plane/shared";
|
|
2
|
+
import type { GLProperty, GLTypeInfo, UIProperty, UIPropertyName } from "../../core/miscellaneous/generic-plane/shared";
|
|
4
3
|
export declare const INSTANCED_PARTICLE_GEOMETRY: InstancedBufferGeometry;
|
|
5
4
|
export declare function collectProperties(keeper: Record<string, GLTypeInfo>, modules: readonly {
|
|
6
5
|
requiredProperties?: Record<string, UIPropertyName>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InstancedBufferAttribute, Mesh } from "three";
|
|
2
|
-
import {
|
|
2
|
+
import type { GLProperty, GLTypeInfo } from "../../core/miscellaneous/generic-plane/shared";
|
|
3
3
|
export declare class UIInstancedParticle extends Mesh {
|
|
4
4
|
private readonly capacityStep;
|
|
5
5
|
readonly propertyBuffers: Record<string, InstancedBufferAttribute>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Vector2Tuple } from "three";
|
|
2
|
+
import { DataTexture } from "three";
|
|
2
3
|
import type { UIColor } from "../../core";
|
|
3
4
|
import type { Vector2Like } from "../../core/miscellaneous/math";
|
|
4
5
|
import type { UITextureConfig } from "../../core/miscellaneous/texture/UITextureView.Internal";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Vector2Like } from "../../core/miscellaneous/math";
|
|
2
|
-
import {
|
|
2
|
+
import type { UIVector2Config } from "../miscellaneous/miscellaneous";
|
|
3
3
|
import { UISpawnModule } from "./UISpawnModule";
|
|
4
4
|
/**
|
|
5
5
|
* Sets particle spawn position offset.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UIAspectConfig, UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous";
|
|
2
2
|
import { UISpawnModule } from "./UISpawnModule";
|
|
3
3
|
/**
|
|
4
4
|
* Assigns random scale to particles.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Vector2Like } from "../../core/miscellaneous/math";
|
|
2
|
-
import {
|
|
2
|
+
import type { UIVector2Config } from "../miscellaneous/miscellaneous";
|
|
3
3
|
import { UISpawnModule } from "./UISpawnModule";
|
|
4
4
|
/**
|
|
5
5
|
* Spawns particles at random positions within a rectangle.
|