@firecms/neat 0.6.0 → 0.7.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 +5 -29
- package/dist/NeatGradient.d.ts +29 -43
- package/dist/NeatGradient.js +346 -897
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.es.js +757 -731
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +103 -120
- package/dist/index.umd.js.map +1 -1
- package/dist/math.d.ts +26 -0
- package/dist/math.js +148 -0
- package/dist/math.js.map +1 -0
- package/dist/shaders.d.ts +6 -0
- package/dist/shaders.js +407 -0
- package/dist/shaders.js.map +1 -0
- package/dist/types.d.ts +52 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +3 -7
- package/src/NeatGradient.ts +410 -967
- package/src/math.ts +162 -0
- package/src/shaders.ts +411 -0
- package/src/types.ts +54 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Neat gradients
|
|
2
2
|
|
|
3
|
-
Create awesome 3D gradients with this
|
|
3
|
+
Create awesome 3D gradients with this WebGL-based library.
|
|
4
|
+
|
|
5
|
+
> **⚠️ Breaking change (v0.7):** Neat no longer depends on three.js. The rendering engine has been rewritten to use raw WebGL. You can safely `npm uninstall three @types/three`. The mouse interaction properties (`mouseDistortionStrength`, `mouseDistortionRadius`, `mouseDecayRate`, `mouseDarken`) have also been removed. All other config properties remain unchanged.
|
|
4
6
|
|
|
5
7
|
Check the demo and gradients editor to find your perfect config here:
|
|
6
8
|
[https://neat.firecms.co/](https://neat.firecms.co/)
|
|
@@ -13,13 +15,13 @@ the license and the credits.
|
|
|
13
15
|
## Installation
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
yarn add @firecms/neat
|
|
18
|
+
yarn add @firecms/neat
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
or
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
|
-
npm install @firecms/neat
|
|
24
|
+
npm install @firecms/neat
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
## Usage
|
|
@@ -345,31 +347,6 @@ export const MyComponent: React.FC = () => {
|
|
|
345
347
|
- **Default:** 0.0
|
|
346
348
|
- **Description:** Blend between original and flow-distorted state
|
|
347
349
|
|
|
348
|
-
### Mouse Interaction Parameters
|
|
349
|
-
|
|
350
|
-
#### `mouseDistortionStrength`
|
|
351
|
-
- **Type:** `number`
|
|
352
|
-
- **Range:** 0 to 2.0
|
|
353
|
-
- **Default:** 0.0
|
|
354
|
-
- **Description:** Strength of mouse-driven distortion. Set to 0 to disable.
|
|
355
|
-
|
|
356
|
-
#### `mouseDistortionRadius`
|
|
357
|
-
- **Type:** `number`
|
|
358
|
-
- **Range:** 0.05 to 2.0
|
|
359
|
-
- **Default:** 0.25
|
|
360
|
-
- **Description:** Radius/area of mouse distortion effect
|
|
361
|
-
|
|
362
|
-
#### `mouseDecayRate`
|
|
363
|
-
- **Type:** `number`
|
|
364
|
-
- **Range:** 0.90 to 0.99
|
|
365
|
-
- **Default:** 0.96
|
|
366
|
-
- **Description:** How quickly mouse trails fade (0.9 = slow/wobbly, 0.99 = fast/sharp)
|
|
367
|
-
|
|
368
|
-
#### `mouseDarken`
|
|
369
|
-
- **Type:** `number`
|
|
370
|
-
- **Range:** 0 to 1
|
|
371
|
-
- **Default:** 0.0
|
|
372
|
-
- **Description:** Darkening effect at mouse interaction points
|
|
373
350
|
|
|
374
351
|
### Procedural Texture Parameters
|
|
375
352
|
*Note: When enabled, replaces color pressure controls*
|
|
@@ -458,7 +435,6 @@ export const MyComponent: React.FC = () => {
|
|
|
458
435
|
- Combine `yOffset` with scroll position for scroll-based gradient effects
|
|
459
436
|
- Enable `wireframe: true` during development to understand the 3D mesh structure
|
|
460
437
|
- Procedural textures work best with `textureEase` values between 0.3 and 0.7
|
|
461
|
-
- For subtle effects, keep `mouseDistortionStrength` below 0.5
|
|
462
438
|
|
|
463
439
|
## NEAT Link
|
|
464
440
|
|
package/dist/NeatGradient.d.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { OrthographicCamera } from "./math";
|
|
2
|
+
export interface WebGLState {
|
|
3
|
+
gl: WebGLRenderingContext | WebGL2RenderingContext;
|
|
4
|
+
program: WebGLProgram;
|
|
5
|
+
buffers: {
|
|
6
|
+
position: WebGLBuffer;
|
|
7
|
+
normal: WebGLBuffer;
|
|
8
|
+
uv: WebGLBuffer;
|
|
9
|
+
index: WebGLBuffer;
|
|
10
|
+
wireframeIndex: WebGLBuffer;
|
|
11
|
+
};
|
|
12
|
+
locations: {
|
|
13
|
+
attributes: Record<string, number>;
|
|
14
|
+
uniforms: Record<string, WebGLUniformLocation | null>;
|
|
15
|
+
};
|
|
16
|
+
camera: OrthographicCamera;
|
|
17
|
+
indexCount: number;
|
|
18
|
+
wireframeIndexCount: number;
|
|
19
|
+
indexType: number;
|
|
20
|
+
}
|
|
9
21
|
export type NeatConfig = {
|
|
10
22
|
resolution?: number;
|
|
11
23
|
speed?: number;
|
|
@@ -36,13 +48,6 @@ export type NeatConfig = {
|
|
|
36
48
|
flowScale?: number;
|
|
37
49
|
flowEase?: number;
|
|
38
50
|
flowEnabled?: boolean;
|
|
39
|
-
/** Strength of mouse-driven distortion */
|
|
40
|
-
mouseDistortionStrength?: number;
|
|
41
|
-
/** Radius / area of mouse-driven distortion in UV space (0–1-ish) */
|
|
42
|
-
mouseDistortionRadius?: number;
|
|
43
|
-
/** How quickly mouse trails decay/fade (0.9=slow/wobbly, 0.99=fast/sharp) */
|
|
44
|
-
mouseDecayRate?: number;
|
|
45
|
-
mouseDarken?: number;
|
|
46
51
|
enableProceduralTexture?: boolean;
|
|
47
52
|
textureVoidLikelihood?: number;
|
|
48
53
|
textureVoidWidthMin?: number;
|
|
@@ -88,23 +93,14 @@ export declare class NeatGradient implements NeatController {
|
|
|
88
93
|
private _colors;
|
|
89
94
|
private _wireframe;
|
|
90
95
|
private _backgroundColor;
|
|
96
|
+
private _backgroundColorRgb;
|
|
91
97
|
private _backgroundAlpha;
|
|
92
98
|
private _flowDistortionA;
|
|
93
99
|
private _flowDistortionB;
|
|
94
100
|
private _flowScale;
|
|
95
101
|
private _flowEase;
|
|
96
102
|
private _flowEnabled;
|
|
97
|
-
private
|
|
98
|
-
private _mouseDistortionRadius;
|
|
99
|
-
private _mouseDecayRate;
|
|
100
|
-
private _mouseDarken;
|
|
101
|
-
private _mouse;
|
|
102
|
-
private _mouseFBO;
|
|
103
|
-
private _sceneMouse;
|
|
104
|
-
private _cameraMouse;
|
|
105
|
-
private _mouseObjects;
|
|
106
|
-
private _currentBrush;
|
|
107
|
-
private _mouseBrushBaseScale;
|
|
103
|
+
private glState;
|
|
108
104
|
private _enableProceduralTexture;
|
|
109
105
|
private _textureVoidLikelihood;
|
|
110
106
|
private _textureVoidWidthMin;
|
|
@@ -121,21 +117,19 @@ export declare class NeatGradient implements NeatController {
|
|
|
121
117
|
private _textureShapeSquiggles;
|
|
122
118
|
private requestRef;
|
|
123
119
|
private sizeObserver;
|
|
124
|
-
private
|
|
125
|
-
private _cachedUniforms;
|
|
120
|
+
private _initialized;
|
|
126
121
|
private _linkElement;
|
|
122
|
+
private _cachedColorRgb;
|
|
127
123
|
private _yOffset;
|
|
128
124
|
private _yOffsetWaveMultiplier;
|
|
129
125
|
private _yOffsetColorMultiplier;
|
|
130
126
|
private _yOffsetFlowMultiplier;
|
|
131
|
-
private _tempClearColor;
|
|
132
127
|
private _resizeTimeoutId;
|
|
133
128
|
private _textureNeedsUpdate;
|
|
134
|
-
private _lastColorUpdate;
|
|
135
129
|
private _linkCheckCounter;
|
|
136
|
-
private _mouseUpdateScheduled;
|
|
137
|
-
private _pendingMousePosition;
|
|
138
130
|
private _colorsChanged;
|
|
131
|
+
private _uniformsDirty;
|
|
132
|
+
private _textureDirty;
|
|
139
133
|
constructor(config: NeatConfig & {
|
|
140
134
|
ref: HTMLCanvasElement;
|
|
141
135
|
resolution?: number;
|
|
@@ -176,11 +170,6 @@ export declare class NeatGradient implements NeatController {
|
|
|
176
170
|
set flowEase(value: number);
|
|
177
171
|
set flowEnabled(value: boolean);
|
|
178
172
|
get flowEnabled(): boolean;
|
|
179
|
-
set mouseDistortionStrength(value: number);
|
|
180
|
-
set mouseDistortionRadius(value: number);
|
|
181
|
-
_updateBrushScale(): void;
|
|
182
|
-
set mouseDecayRate(value: number);
|
|
183
|
-
set mouseDarken(value: number);
|
|
184
173
|
set enableProceduralTexture(value: boolean);
|
|
185
174
|
set textureVoidLikelihood(value: number);
|
|
186
175
|
set textureVoidWidthMin(value: number);
|
|
@@ -195,10 +184,7 @@ export declare class NeatGradient implements NeatController {
|
|
|
195
184
|
set textureShapeCircles(value: number);
|
|
196
185
|
set textureShapeBars(value: number);
|
|
197
186
|
set textureShapeSquiggles(value: number);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
_onMouseMove(e: MouseEvent): void;
|
|
202
|
-
_createProceduralTexture(): THREE.Texture;
|
|
187
|
+
_hexToRgb(hex: string): [number, number, number];
|
|
188
|
+
_initScene(resolution: number): WebGLState;
|
|
189
|
+
_createProceduralTexture(gl: WebGLRenderingContext | WebGL2RenderingContext): WebGLTexture | null;
|
|
203
190
|
}
|
|
204
|
-
export {};
|