@firecms/neat 0.1.0 → 0.1.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.
@@ -0,0 +1,74 @@
1
+ import * as THREE from "three";
2
+ declare type SceneState = {
3
+ renderer: THREE.WebGLRenderer;
4
+ camera: THREE.OrthographicCamera;
5
+ scene: THREE.Scene;
6
+ meshes: THREE.Mesh[];
7
+ };
8
+ export declare type NeatConfig = {
9
+ speed?: number;
10
+ horizontalPressure?: number;
11
+ verticalPressure?: number;
12
+ waveFrequencyX?: number;
13
+ waveFrequencyY?: number;
14
+ waveAmplitude?: number;
15
+ highlights?: number;
16
+ shadows?: number;
17
+ saturation?: number;
18
+ colors: NeatColor[];
19
+ colorBlending?: number;
20
+ wireframe?: boolean;
21
+ backgroundColor?: string;
22
+ backgroundAlpha?: number;
23
+ };
24
+ export declare type NeatColor = {
25
+ color: string;
26
+ enabled: boolean;
27
+ /**
28
+ * Value from 0 to 1
29
+ */
30
+ influence?: number;
31
+ };
32
+ export declare type NeatController = {
33
+ destroy: () => void;
34
+ };
35
+ export declare class NeatGradient implements NeatController {
36
+ private _speed;
37
+ private _horizontalPressure;
38
+ private _verticalPressure;
39
+ private _waveFrequencyX;
40
+ private _waveFrequencyY;
41
+ private _waveAmplitude;
42
+ private _shadows;
43
+ private _highlights;
44
+ private _saturation;
45
+ private _colorBlending;
46
+ private _colors;
47
+ private _wireframe;
48
+ private _backgroundColor;
49
+ private _backgroundAlpha;
50
+ private requestRef;
51
+ private sizeObserver;
52
+ private readonly sceneState;
53
+ constructor(config: NeatConfig & {
54
+ ref: HTMLCanvasElement;
55
+ });
56
+ destroy(): void;
57
+ set speed(speed: number);
58
+ set horizontalPressure(horizontalPressure: number);
59
+ set verticalPressure(verticalPressure: number);
60
+ set waveFrequencyX(waveFrequencyX: number);
61
+ set waveFrequencyY(waveFrequencyY: number);
62
+ set waveAmplitude(waveAmplitude: number);
63
+ set colors(colors: NeatColor[]);
64
+ set highlights(highlights: number);
65
+ set shadows(shadows: number);
66
+ set saturation(saturation: number);
67
+ set colorBlending(colorBlending: number);
68
+ set wireframe(wireframe: boolean);
69
+ set backgroundColor(backgroundColor: string);
70
+ set backgroundAlpha(backgroundAlpha: number);
71
+ _initScene(ref: HTMLCanvasElement, width: number, height: number): SceneState;
72
+ _buildMaterial(width: number, height: number): THREE.ShaderMaterial;
73
+ }
74
+ export {};
@@ -0,0 +1,607 @@
1
+ import * as THREE from "three";
2
+ const PLANE_WIDTH = 50;
3
+ const PLANE_HEIGHT = 80;
4
+ const WIREFRAME = true;
5
+ const COLORS_COUNT = 5;
6
+ const clock = new THREE.Clock();
7
+ export class NeatGradient {
8
+ _speed = -1;
9
+ _horizontalPressure = -1;
10
+ _verticalPressure = -1;
11
+ _waveFrequencyX = -1;
12
+ _waveFrequencyY = -1;
13
+ _waveAmplitude = -1;
14
+ _shadows = -1;
15
+ _highlights = -1;
16
+ _saturation = -1;
17
+ _colorBlending = -1;
18
+ _colors = [];
19
+ _wireframe = false;
20
+ _backgroundColor = "#FFFFFF";
21
+ _backgroundAlpha = 1.0;
22
+ requestRef = -1;
23
+ sizeObserver;
24
+ sceneState;
25
+ constructor(config) {
26
+ const { ref, speed = 4, horizontalPressure = 3, verticalPressure = 3, waveFrequencyX = 5, waveFrequencyY = 5, waveAmplitude = 3, colors, highlights = 4, shadows = 4, saturation = 0, colorBlending = 5, wireframe = false, backgroundColor = "#FFFFFF", backgroundAlpha = 1.0, } = config;
27
+ const width = ref.width, height = ref.height;
28
+ this.destroy = this.destroy.bind(this);
29
+ this._initScene = this._initScene.bind(this);
30
+ this._buildMaterial = this._buildMaterial.bind(this);
31
+ this.speed = speed;
32
+ this.horizontalPressure = horizontalPressure;
33
+ this.verticalPressure = verticalPressure;
34
+ this.waveFrequencyX = waveFrequencyX;
35
+ this.waveFrequencyY = waveFrequencyY;
36
+ this.waveAmplitude = waveAmplitude;
37
+ this.colorBlending = colorBlending;
38
+ this.colors = colors;
39
+ this.shadows = shadows;
40
+ this.highlights = highlights;
41
+ this.saturation = saturation;
42
+ this.wireframe = wireframe;
43
+ this.backgroundColor = backgroundColor;
44
+ this.backgroundAlpha = backgroundAlpha;
45
+ this.sceneState = this._initScene(ref, width, height);
46
+ const { renderer, camera, scene, meshes } = this.sceneState;
47
+ let tick = 0;
48
+ const render = () => {
49
+ if (Math.floor(tick * 10) % 5 === 0) {
50
+ addNeatLink(ref);
51
+ }
52
+ renderer.setClearColor(this._backgroundColor, this._backgroundAlpha);
53
+ meshes.forEach((mesh) => {
54
+ const colors = [
55
+ ...this._colors.map(color => ({
56
+ is_active: color.enabled,
57
+ color: new THREE.Color(color.color),
58
+ influence: color.influence
59
+ })),
60
+ ...Array.from({ length: COLORS_COUNT - this._colors.length }).map(() => ({
61
+ is_active: false,
62
+ color: new THREE.Color(0x000000)
63
+ }))
64
+ ];
65
+ tick += clock.getDelta() * this._speed;
66
+ // @ts-ignore
67
+ mesh.material.uniforms.u_time.value = tick;
68
+ // @ts-ignore
69
+ mesh.material.uniforms.u_resolution = { value: new THREE.Vector2(width, height) };
70
+ // @ts-ignore
71
+ mesh.material.uniforms.u_color_pressure = { value: new THREE.Vector2(this._horizontalPressure, this._verticalPressure) };
72
+ // @ts-ignore
73
+ mesh.material.uniforms.u_wave_frequency_x = { value: this._waveFrequencyX };
74
+ // @ts-ignore
75
+ mesh.material.uniforms.u_wave_frequency_y = { value: this._waveFrequencyY };
76
+ // @ts-ignore
77
+ mesh.material.uniforms.u_wave_amplitude = { value: this._waveAmplitude };
78
+ // @ts-ignore
79
+ mesh.material.uniforms.u_plane_width = { value: PLANE_WIDTH };
80
+ // @ts-ignore
81
+ mesh.material.uniforms.u_plane_height = { value: PLANE_HEIGHT };
82
+ // @ts-ignore
83
+ mesh.material.uniforms.u_color_blending = { value: this._colorBlending };
84
+ // @ts-ignore
85
+ mesh.material.uniforms.u_colors = { value: colors };
86
+ // @ts-ignore
87
+ mesh.material.uniforms.u_colors_count = { value: COLORS_COUNT };
88
+ // @ts-ignore
89
+ mesh.material.uniforms.u_shadows = { value: this._shadows };
90
+ // @ts-ignore
91
+ mesh.material.uniforms.u_highlights = { value: this._highlights };
92
+ // @ts-ignore
93
+ mesh.material.uniforms.u_saturation = { value: this._saturation };
94
+ // @ts-ignore
95
+ mesh.material.wireframe = this._wireframe;
96
+ });
97
+ renderer.render(scene, camera);
98
+ this.requestRef = requestAnimationFrame(render);
99
+ };
100
+ const setSize = () => {
101
+ const canvas = renderer.domElement;
102
+ const width = canvas.clientWidth;
103
+ const height = canvas.clientHeight;
104
+ this.sceneState.renderer.setSize(width, height, false);
105
+ updateCamera(this.sceneState.camera, width, height);
106
+ };
107
+ this.sizeObserver = new ResizeObserver(entries => {
108
+ setSize();
109
+ });
110
+ this.sizeObserver.observe(ref);
111
+ render();
112
+ }
113
+ destroy() {
114
+ if (this) {
115
+ cancelAnimationFrame(this.requestRef);
116
+ this.sizeObserver.disconnect();
117
+ }
118
+ }
119
+ set speed(speed) {
120
+ this._speed = speed / 20;
121
+ }
122
+ set horizontalPressure(horizontalPressure) {
123
+ this._horizontalPressure = horizontalPressure / 4;
124
+ }
125
+ set verticalPressure(verticalPressure) {
126
+ this._verticalPressure = verticalPressure / 4;
127
+ }
128
+ set waveFrequencyX(waveFrequencyX) {
129
+ this._waveFrequencyX = waveFrequencyX * 0.04;
130
+ }
131
+ set waveFrequencyY(waveFrequencyY) {
132
+ this._waveFrequencyY = waveFrequencyY * 0.04;
133
+ }
134
+ set waveAmplitude(waveAmplitude) {
135
+ this._waveAmplitude = waveAmplitude * .75;
136
+ }
137
+ set colors(colors) {
138
+ this._colors = colors;
139
+ }
140
+ set highlights(highlights) {
141
+ this._highlights = highlights / 100;
142
+ }
143
+ set shadows(shadows) {
144
+ this._shadows = shadows / 100;
145
+ }
146
+ set saturation(saturation) {
147
+ this._saturation = saturation / 10;
148
+ }
149
+ set colorBlending(colorBlending) {
150
+ this._colorBlending = colorBlending / 10;
151
+ }
152
+ set wireframe(wireframe) {
153
+ this._wireframe = wireframe;
154
+ }
155
+ set backgroundColor(backgroundColor) {
156
+ this._backgroundColor = backgroundColor;
157
+ }
158
+ set backgroundAlpha(backgroundAlpha) {
159
+ this._backgroundAlpha = backgroundAlpha;
160
+ }
161
+ _initScene(ref, width, height) {
162
+ const renderer = new THREE.WebGLRenderer({
163
+ // antialias: true,
164
+ alpha: true,
165
+ canvas: ref
166
+ });
167
+ renderer.setClearColor(0xFF0000, .5);
168
+ renderer.setSize(width, height, false);
169
+ const meshes = [];
170
+ const scene = new THREE.Scene();
171
+ const material = this._buildMaterial(width, height);
172
+ const geo = new THREE.PlaneGeometry(PLANE_WIDTH, PLANE_HEIGHT, 240, 240);
173
+ const plane = new THREE.Mesh(geo, material);
174
+ plane.rotation.x = -Math.PI / 3.5;
175
+ plane.position.z = -1;
176
+ meshes.push(plane);
177
+ scene.add(plane);
178
+ const camera = new THREE.OrthographicCamera(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
179
+ // camera.zoom = 1;
180
+ updateCamera(camera, width, height);
181
+ return {
182
+ renderer,
183
+ camera,
184
+ scene,
185
+ meshes
186
+ };
187
+ }
188
+ _buildMaterial(width, height) {
189
+ const colors = [
190
+ ...this._colors.map(color => ({
191
+ is_active: color.enabled,
192
+ color: new THREE.Color(color.color),
193
+ influence: color.influence
194
+ })),
195
+ ...Array.from({ length: COLORS_COUNT - this._colors.length }).map(() => ({
196
+ is_active: false,
197
+ color: new THREE.Color(0x000000)
198
+ }))
199
+ ];
200
+ const uniforms = {
201
+ u_time: { value: 0 },
202
+ u_color_pressure: { value: new THREE.Vector2(this._horizontalPressure, this._verticalPressure) },
203
+ u_wave_frequency_x: { value: this._waveFrequencyX },
204
+ u_wave_frequency_y: { value: this._waveFrequencyY },
205
+ u_wave_amplitude: { value: this._waveAmplitude },
206
+ u_resolution: { value: new THREE.Vector2(width, height) },
207
+ u_colors: { value: colors },
208
+ u_colors_count: { value: this._colors.length },
209
+ u_plane_width: { value: PLANE_WIDTH },
210
+ u_plane_height: { value: PLANE_HEIGHT },
211
+ u_shadows: { value: this._shadows },
212
+ u_highlights: { value: this._highlights },
213
+ };
214
+ const material = new THREE.ShaderMaterial({
215
+ uniforms: uniforms,
216
+ vertexShader: buildUniforms() + buildNoise() + buildColorFunctions() + buildVertexShader(),
217
+ fragmentShader: buildUniforms() + buildColorFunctions() + buildFragmentShader()
218
+ });
219
+ material.wireframe = WIREFRAME;
220
+ return material;
221
+ }
222
+ }
223
+ function updateCamera(camera, width, height) {
224
+ const viewPortAreaRatio = 1000000;
225
+ const areaViewPort = width * height;
226
+ const targetPlaneArea = areaViewPort / viewPortAreaRatio *
227
+ PLANE_WIDTH * PLANE_HEIGHT / 1.5;
228
+ const ratio = width / height;
229
+ const targetWidth = Math.sqrt(targetPlaneArea * ratio);
230
+ const targetHeight = targetPlaneArea / targetWidth;
231
+ const left = -PLANE_WIDTH / 2;
232
+ const right = Math.min((left + targetWidth) / 1.5, PLANE_WIDTH / 2);
233
+ const top = PLANE_HEIGHT / 4;
234
+ const bottom = Math.max((top - targetHeight) / 2, -PLANE_HEIGHT / 4);
235
+ const near = -100;
236
+ const far = 1000;
237
+ camera.left = left;
238
+ camera.right = right;
239
+ camera.top = top;
240
+ camera.bottom = bottom;
241
+ camera.near = near;
242
+ camera.far = far;
243
+ camera.updateProjectionMatrix();
244
+ }
245
+ function buildVertexShader() {
246
+ return `
247
+
248
+ void main() {
249
+
250
+ vUv = uv;
251
+
252
+ v_displacement_amount = cnoise( vec3(
253
+ u_wave_frequency_x * position.x + u_time,
254
+ u_wave_frequency_y * position.y + u_time,
255
+ u_time
256
+ ));
257
+
258
+ vec3 color;
259
+
260
+ // float t = mod(u_base_color, 100.0);
261
+ color = u_colors[0].color;
262
+
263
+ vec2 noise_cord = vUv * u_color_pressure;
264
+
265
+ const float minNoise = .0;
266
+ const float maxNoise = .9;
267
+
268
+ for (int i = 1; i < u_colors_count; i++) {
269
+
270
+ if(u_colors[i].is_active == 1.0){
271
+ float noiseFlow = (1. + float(i)) / 30.;
272
+ float noiseSpeed = (1. + float(i)) * 0.11;
273
+ float noiseSeed = 13. + float(i) * 7.;
274
+
275
+ float noise = snoise(
276
+ vec3(
277
+ noise_cord.x * u_color_pressure.x + u_time * noiseFlow * 2.,
278
+ noise_cord.y * u_color_pressure.y,
279
+ u_time * noiseSpeed
280
+ ) + noiseSeed
281
+ );
282
+
283
+ noise = clamp(minNoise, maxNoise + float(i) * 0.02, noise);
284
+ vec3 nextColor = u_colors[i].color;
285
+ color = mix(color, nextColor, smoothstep(0.0, u_color_blending, noise));
286
+ }
287
+
288
+ }
289
+
290
+ v_color = color;
291
+
292
+ vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
293
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );
294
+
295
+ v_new_position = gl_Position;
296
+ }
297
+ `;
298
+ }
299
+ function buildFragmentShader() {
300
+ return `
301
+
302
+ void main(){
303
+ vec3 color = v_color;
304
+
305
+ color.rgb += pow(v_displacement_amount, 1.0) * u_highlights;
306
+ color.rgb -= pow(1.0 - v_displacement_amount, 2.0) * u_shadows;
307
+ color = saturation(color, 1.0 + u_saturation);
308
+
309
+ gl_FragColor = vec4(color,1.0);
310
+ }
311
+ `;
312
+ }
313
+ const buildUniforms = () => `
314
+ precision highp float;
315
+
316
+ struct Color {
317
+ float is_active;
318
+ vec3 color;
319
+ float value;
320
+ };
321
+
322
+ uniform float u_time;
323
+
324
+ uniform float u_wave_amplitude;
325
+ uniform float u_wave_frequency_x;
326
+ uniform float u_wave_frequency_y;
327
+
328
+ uniform vec2 u_color_pressure;
329
+
330
+ uniform float u_plane_width;
331
+ uniform float u_plane_height;
332
+
333
+ uniform float u_shadows;
334
+ uniform float u_highlights;
335
+ uniform float u_saturation;
336
+
337
+ uniform float u_color_blending;
338
+
339
+ uniform int u_colors_count;
340
+ uniform Color u_colors[5];
341
+ uniform vec2 u_resolution;
342
+
343
+ varying vec2 vUv;
344
+ varying vec4 v_new_position;
345
+ varying vec3 v_color;
346
+ varying float v_displacement_amount;
347
+
348
+ `;
349
+ const buildNoise = () => `
350
+
351
+ vec3 mod289(vec3 x)
352
+ {
353
+ return x - floor(x * (1.0 / 289.0)) * 289.0;
354
+ }
355
+
356
+ vec4 mod289(vec4 x)
357
+ {
358
+ return x - floor(x * (1.0 / 289.0)) * 289.0;
359
+ }
360
+
361
+ vec4 permute(vec4 x)
362
+ {
363
+ return mod289(((x*34.0)+1.0)*x);
364
+ }
365
+
366
+ vec4 taylorInvSqrt(vec4 r)
367
+ {
368
+ return 1.79284291400159 - 0.85373472095314 * r;
369
+ }
370
+
371
+ vec3 fade(vec3 t) {
372
+ return t*t*t*(t*(t*6.0-15.0)+10.0);
373
+ }
374
+
375
+ float snoise(vec3 v)
376
+ {
377
+ const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
378
+ const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
379
+
380
+ // First corner
381
+ vec3 i = floor(v + dot(v, C.yyy) );
382
+ vec3 x0 = v - i + dot(i, C.xxx) ;
383
+
384
+ // Other corners
385
+ vec3 g = step(x0.yzx, x0.xyz);
386
+ vec3 l = 1.0 - g;
387
+ vec3 i1 = min( g.xyz, l.zxy );
388
+ vec3 i2 = max( g.xyz, l.zxy );
389
+
390
+ // x0 = x0 - 0.0 + 0.0 * C.xxx;
391
+ // x1 = x0 - i1 + 1.0 * C.xxx;
392
+ // x2 = x0 - i2 + 2.0 * C.xxx;
393
+ // x3 = x0 - 1.0 + 3.0 * C.xxx;
394
+ vec3 x1 = x0 - i1 + C.xxx;
395
+ vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
396
+ vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
397
+
398
+ // Permutations
399
+ i = mod289(i);
400
+ vec4 p = permute( permute( permute(
401
+ i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
402
+ + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
403
+ + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
404
+
405
+ // Gradients: 7x7 points over a square, mapped onto an octahedron.
406
+ // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
407
+ float n_ = 0.142857142857; // 1.0/7.0
408
+ vec3 ns = n_ * D.wyz - D.xzx;
409
+
410
+ vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)
411
+
412
+ vec4 x_ = floor(j * ns.z);
413
+ vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
414
+
415
+ vec4 x = x_ *ns.x + ns.yyyy;
416
+ vec4 y = y_ *ns.x + ns.yyyy;
417
+ vec4 h = 1.0 - abs(x) - abs(y);
418
+
419
+ vec4 b0 = vec4( x.xy, y.xy );
420
+ vec4 b1 = vec4( x.zw, y.zw );
421
+
422
+ //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
423
+ //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
424
+ vec4 s0 = floor(b0)*2.0 + 1.0;
425
+ vec4 s1 = floor(b1)*2.0 + 1.0;
426
+ vec4 sh = -step(h, vec4(0.0));
427
+
428
+ vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
429
+ vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
430
+
431
+ vec3 p0 = vec3(a0.xy,h.x);
432
+ vec3 p1 = vec3(a0.zw,h.y);
433
+ vec3 p2 = vec3(a1.xy,h.z);
434
+ vec3 p3 = vec3(a1.zw,h.w);
435
+
436
+ //Normalise gradients
437
+ vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
438
+ p0 *= norm.x;
439
+ p1 *= norm.y;
440
+ p2 *= norm.z;
441
+ p3 *= norm.w;
442
+
443
+ // Mix final noise value
444
+ vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
445
+ m = m * m;
446
+ return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
447
+ dot(p2,x2), dot(p3,x3) ) );
448
+ }
449
+
450
+ // Classic Perlin noise
451
+ float cnoise(vec3 P)
452
+ {
453
+ vec3 Pi0 = floor(P); // Integer part for indexing
454
+ vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1
455
+ Pi0 = mod289(Pi0);
456
+ Pi1 = mod289(Pi1);
457
+ vec3 Pf0 = fract(P); // Fractional part for interpolation
458
+ vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0
459
+ vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
460
+ vec4 iy = vec4(Pi0.yy, Pi1.yy);
461
+ vec4 iz0 = Pi0.zzzz;
462
+ vec4 iz1 = Pi1.zzzz;
463
+
464
+ vec4 ixy = permute(permute(ix) + iy);
465
+ vec4 ixy0 = permute(ixy + iz0);
466
+ vec4 ixy1 = permute(ixy + iz1);
467
+
468
+ vec4 gx0 = ixy0 * (1.0 / 7.0);
469
+ vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
470
+ gx0 = fract(gx0);
471
+ vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
472
+ vec4 sz0 = step(gz0, vec4(0.0));
473
+ gx0 -= sz0 * (step(0.0, gx0) - 0.5);
474
+ gy0 -= sz0 * (step(0.0, gy0) - 0.5);
475
+
476
+ vec4 gx1 = ixy1 * (1.0 / 7.0);
477
+ vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
478
+ gx1 = fract(gx1);
479
+ vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
480
+ vec4 sz1 = step(gz1, vec4(0.0));
481
+ gx1 -= sz1 * (step(0.0, gx1) - 0.5);
482
+ gy1 -= sz1 * (step(0.0, gy1) - 0.5);
483
+
484
+ vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
485
+ vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
486
+ vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
487
+ vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
488
+ vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
489
+ vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
490
+ vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
491
+ vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
492
+
493
+ vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
494
+ g000 *= norm0.x;
495
+ g010 *= norm0.y;
496
+ g100 *= norm0.z;
497
+ g110 *= norm0.w;
498
+ vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
499
+ g001 *= norm1.x;
500
+ g011 *= norm1.y;
501
+ g101 *= norm1.z;
502
+ g111 *= norm1.w;
503
+
504
+ float n000 = dot(g000, Pf0);
505
+ float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
506
+ float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
507
+ float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
508
+ float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
509
+ float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
510
+ float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
511
+ float n111 = dot(g111, Pf1);
512
+
513
+ vec3 fade_xyz = fade(Pf0);
514
+ vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
515
+ vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
516
+ float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
517
+ return 2.2 * n_xyz;
518
+ }
519
+
520
+ // YUV to RGB matrix
521
+ mat3 yuv2rgb = mat3(1.0, 0.0, 1.13983,
522
+ 1.0, -0.39465, -0.58060,
523
+ 1.0, 2.03211, 0.0);
524
+
525
+ // RGB to YUV matrix
526
+ mat3 rgb2yuv = mat3(0.2126, 0.7152, 0.0722,
527
+ -0.09991, -0.33609, 0.43600,
528
+ 0.615, -0.5586, -0.05639);
529
+
530
+ `;
531
+ const buildColorFunctions = () => `
532
+
533
+ vec3 saturation(vec3 rgb, float adjustment) {
534
+ const vec3 W = vec3(0.2125, 0.7154, 0.0721);
535
+ vec3 intensity = vec3(dot(rgb, W));
536
+ return mix(intensity, rgb, adjustment);
537
+ }
538
+
539
+ float saturation(vec3 rgb)
540
+ {
541
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
542
+ vec4 p = mix(vec4(rgb.bg, K.wz), vec4(rgb.gb, K.xy), step(rgb.b, rgb.g));
543
+ vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));
544
+
545
+ float d = q.x - min(q.w, q.y);
546
+ float e = 1.0e-10;
547
+ return abs(6.0 * d + e);
548
+ }
549
+
550
+ // get saturation of a color in values between 0 and 1
551
+ float getSaturation(vec3 color) {
552
+ float max = max(color.r, max(color.g, color.b));
553
+ float min = min(color.r, min(color.g, color.b));
554
+ return (max - min) / max;
555
+ }
556
+
557
+ vec3 rgb2hsv(vec3 c)
558
+ {
559
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
560
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
561
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
562
+
563
+ float d = q.x - min(q.w, q.y);
564
+ float e = 1.0e-10;
565
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
566
+ }
567
+
568
+ vec3 hsv2rgb(vec3 c)
569
+ {
570
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
571
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
572
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
573
+ }
574
+ `;
575
+ const setLinkStyles = (link) => {
576
+ link.id = "neat-link";
577
+ link.href = "https://neat.firecms.co";
578
+ link.target = "_blank";
579
+ link.style.position = "absolute";
580
+ link.style.display = "block";
581
+ link.style.opacity = "1";
582
+ link.style.bottom = "0";
583
+ link.style.right = "0";
584
+ link.style.padding = "10px";
585
+ link.style.color = "#dcdcdc";
586
+ link.style.fontFamily = "sans-serif";
587
+ link.style.fontSize = "16px";
588
+ link.style.fontWeight = "bold";
589
+ link.style.textDecoration = "none";
590
+ link.style.zIndex = "100";
591
+ link.innerHTML = "NEAT";
592
+ };
593
+ const addNeatLink = (ref) => {
594
+ const existingLinks = ref.parentElement?.getElementsByTagName("a");
595
+ if (existingLinks) {
596
+ for (let i = 0; i < existingLinks.length; i++) {
597
+ if (existingLinks[i].id === "neat-link") {
598
+ setLinkStyles(existingLinks[i]);
599
+ return;
600
+ }
601
+ }
602
+ }
603
+ const link = document.createElement("a");
604
+ setLinkStyles(link);
605
+ ref.parentElement?.appendChild(link);
606
+ };
607
+ //# sourceMappingURL=NeatGradient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NeatGradient.js","sourceRoot":"","sources":["../src/NeatGradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AAuChC,MAAM,OAAO,YAAY;IAEb,MAAM,GAAW,CAAC,CAAC,CAAC;IAEpB,mBAAmB,GAAW,CAAC,CAAC,CAAC;IACjC,iBAAiB,GAAW,CAAC,CAAC,CAAC;IAE/B,eAAe,GA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