@paper-design/shaders 0.0.31-backbuffer-experiment.2 → 0.0.32

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.
Files changed (68) hide show
  1. package/README.md +7 -4
  2. package/dist/index.d.ts +1 -1
  3. package/dist/shader-mount.d.ts +0 -9
  4. package/dist/shaders/dithering.d.ts +6 -6
  5. package/dist/shaders/dot-orbit.d.ts +0 -3
  6. package/dist/shaders/god-rays.d.ts +3 -6
  7. package/dist/shaders/grain-gradient.d.ts +0 -2
  8. package/dist/shaders/liquid-metal.d.ts +10 -25
  9. package/dist/shaders/metaballs.d.ts +0 -3
  10. package/dist/shaders/neuro-noise.d.ts +4 -10
  11. package/dist/shaders/perlin-noise.d.ts +8 -8
  12. package/dist/shaders/spiral.d.ts +6 -6
  13. package/dist/shaders/swirl.d.ts +0 -2
  14. package/dist/shaders/voronoi.d.ts +5 -5
  15. package/dist/shaders/waves.d.ts +6 -6
  16. package/package.json +2 -2
  17. package/dist/get-shader-color-from-string.js +0 -93
  18. package/dist/get-shader-color-from-string.js.map +0 -7
  19. package/dist/get-shader-noise-texture.js +0 -23
  20. package/dist/get-shader-noise-texture.js.map +0 -7
  21. package/dist/index.js +0 -109
  22. package/dist/index.js.map +0 -7
  23. package/dist/shader-color-spaces.js +0 -96
  24. package/dist/shader-color-spaces.js.map +0 -7
  25. package/dist/shader-mount.js +0 -733
  26. package/dist/shader-mount.js.map +0 -7
  27. package/dist/shader-sizing.js +0 -193
  28. package/dist/shader-sizing.js.map +0 -7
  29. package/dist/shader-utils.js +0 -59
  30. package/dist/shader-utils.js.map +0 -7
  31. package/dist/shaders/dithering.js +0 -221
  32. package/dist/shaders/dithering.js.map +0 -7
  33. package/dist/shaders/dot-grid.js +0 -107
  34. package/dist/shaders/dot-grid.js.map +0 -7
  35. package/dist/shaders/dot-orbit.js +0 -124
  36. package/dist/shaders/dot-orbit.js.map +0 -7
  37. package/dist/shaders/god-rays.js +0 -133
  38. package/dist/shaders/god-rays.js.map +0 -7
  39. package/dist/shaders/grain-gradient.js +0 -243
  40. package/dist/shaders/grain-gradient.js.map +0 -7
  41. package/dist/shaders/liquid-metal.js +0 -221
  42. package/dist/shaders/liquid-metal.js.map +0 -7
  43. package/dist/shaders/mesh-gradient.js +0 -97
  44. package/dist/shaders/mesh-gradient.js.map +0 -7
  45. package/dist/shaders/metaballs.js +0 -110
  46. package/dist/shaders/metaballs.js.map +0 -7
  47. package/dist/shaders/neuro-noise.js +0 -81
  48. package/dist/shaders/neuro-noise.js.map +0 -7
  49. package/dist/shaders/perlin-noise.js +0 -201
  50. package/dist/shaders/perlin-noise.js.map +0 -7
  51. package/dist/shaders/pulsing-border.js +0 -218
  52. package/dist/shaders/pulsing-border.js.map +0 -7
  53. package/dist/shaders/simplex-noise.js +0 -103
  54. package/dist/shaders/simplex-noise.js.map +0 -7
  55. package/dist/shaders/smoke-ring.js +0 -141
  56. package/dist/shaders/smoke-ring.js.map +0 -7
  57. package/dist/shaders/spiral.js +0 -83
  58. package/dist/shaders/spiral.js.map +0 -7
  59. package/dist/shaders/swirl.js +0 -91
  60. package/dist/shaders/swirl.js.map +0 -7
  61. package/dist/shaders/voronoi.js +0 -143
  62. package/dist/shaders/voronoi.js.map +0 -7
  63. package/dist/shaders/warp.js +0 -128
  64. package/dist/shaders/warp.js.map +0 -7
  65. package/dist/shaders/waves.js +0 -68
  66. package/dist/shaders/waves.js.map +0 -7
  67. package/dist/types.js +0 -6
  68. package/dist/types.js.map +0 -7
@@ -1,221 +0,0 @@
1
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
- * Paper Shaders *
3
- * https://github.com/paper-design/shaders *
4
- * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5
-
6
- import { sizingVariablesDeclaration } from "../shader-sizing";
7
- import { declarePI, declareRotate, declareSimplexNoise, colorBandingFix } from "../shader-utils";
8
- const liquidMetalFragmentShader = `#version 300 es
9
- precision mediump float;
10
-
11
- uniform float u_time;
12
-
13
- uniform vec4 u_colorBack;
14
- uniform vec4 u_colorTint;
15
-
16
- uniform float u_softness;
17
- uniform float u_repetition;
18
- uniform float u_shiftRed;
19
- uniform float u_shiftBlue;
20
- uniform float u_distortion;
21
- uniform float u_contour;
22
- uniform float u_shape;
23
-
24
- ${sizingVariablesDeclaration}
25
-
26
- out vec4 fragColor;
27
-
28
- ${declarePI}
29
- ${declareRotate}
30
- ${declareSimplexNoise}
31
-
32
- float getColorChanges(float c1, float c2, float stripe_p, vec3 w, float blur, float bump, float tint) {
33
-
34
- float ch = mix(c2, c1, smoothstep(.0, blur, stripe_p));
35
-
36
- float border = w[0];
37
- ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));
38
-
39
- border = w[0] + .4 * (1. - bump) * w[1];
40
- ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));
41
-
42
- border = w[0] + .5 * (1. - bump) * w[1];
43
- ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));
44
-
45
- border = w[0] + w[1];
46
- ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));
47
-
48
- float gradient_t = (stripe_p - w[0] - w[1]) / w[2];
49
- float gradient = mix(c1, c2, smoothstep(0., 1., gradient_t));
50
- ch = mix(ch, gradient, smoothstep(border - blur, border + blur, stripe_p));
51
-
52
- // ch = 1. - min(1., (1. - ch) / max(tint, .0001));
53
- ch = mix(ch, 1. - min(1., (1. - ch) / max(tint, 0.0001)), u_colorTint.a);
54
- return ch;
55
- }
56
-
57
- void main() {
58
-
59
- float t = .1 * u_time;
60
-
61
- vec2 uv = v_objectUV;
62
- uv += .5;
63
- uv.y = 1. - uv.y;
64
-
65
- float cycleWidth = .5 * u_repetition;
66
-
67
- float mask = 1.;
68
- float contOffset = 1.;
69
-
70
- if (u_shape < 1.) {
71
-
72
- vec2 borderUV = v_responsiveUV + .5;
73
- float ratio = v_responsiveBoxGivenSize.x / v_responsiveBoxGivenSize.y;
74
- vec2 edge = min(borderUV, 1. - borderUV);
75
- vec2 pixel_thickness = 250. / v_responsiveBoxGivenSize;
76
- float maskX = smoothstep(0.0, pixel_thickness.x, edge.x);
77
- float maskY = smoothstep(0.0, pixel_thickness.y, edge.y);
78
- maskX = pow(maskX, .25);
79
- maskY = pow(maskY, .25);
80
- mask = clamp(1. - maskX * maskY, 0., 1.);
81
-
82
- uv = v_responsiveUV;
83
- if (ratio > 1.) {
84
- uv.y /= ratio;
85
- } else {
86
- uv.x *= ratio;
87
- }
88
- uv += .5;
89
- uv.y = 1. - uv.y;
90
-
91
- cycleWidth *= 2.;
92
- contOffset = 1.5;
93
-
94
- } else if (u_shape < 2.) {
95
- vec2 shapeUV = uv - .5;
96
- shapeUV *= .67;
97
- mask = pow(clamp(3. * length(shapeUV), 0., 1.), 18.);
98
- } else if (u_shape < 3.) {
99
- vec2 shapeUV = uv - .5;
100
- shapeUV *= 1.68;
101
-
102
- float r = length(shapeUV) * 2.;
103
- float a = atan(shapeUV.y, shapeUV.x) + .2;
104
- r *= (1. + .05 * sin(3. * a + 2. * t));
105
- float f = abs(cos(a * 3.));
106
- mask = smoothstep(f, f + .7, r);
107
- mask = pow(mask, 2.);
108
-
109
- uv *= .8;
110
- cycleWidth *= 1.6;
111
-
112
- } else if (u_shape < 4.) {
113
- vec2 shapeUV = uv - .5;
114
- shapeUV *= 1.3;
115
- mask = 0.;
116
- for (int i = 0; i < 5; i++) {
117
- float fi = float(i);
118
- float speed = 4.5 + 2. * sin(fi * 12.345);
119
- float angle = -fi * 1.5;
120
- vec2 dir1 = vec2(cos(angle), sin(angle));
121
- vec2 dir2 = vec2(cos(angle + 1.57), sin(angle + 1.));
122
- vec2 traj = .4 * (dir1 * sin(t * speed + fi * 1.23) + dir2 * cos(t * (speed * 0.7) + fi * 2.17));
123
- float d = length(shapeUV + traj);
124
- mask += pow(1.0 - clamp(d, 0.0, 1.0), 4.0);
125
- }
126
- mask = 1. - smoothstep(.65, .9, mask);
127
- mask = pow(mask, 4.);
128
- }
129
-
130
- float opacity = 1. - smoothstep(.8, .82, mask);
131
-
132
- float ridge = .15 * (smoothstep(.0, .15, uv.y) * smoothstep(.4, .15, uv.y));
133
- ridge += .05 * (smoothstep(.1, .2, 1. - uv.y) * smoothstep(.4, .2, 1. - uv.y));
134
- mask += ridge;
135
-
136
- float diagBLtoTR = uv.x - uv.y;
137
- float diagTLtoBR = uv.x + uv.y;
138
-
139
- vec3 color = vec3(0.);
140
- vec3 color1 = vec3(.98, 0.98, 1.);
141
- vec3 color2 = vec3(.1, .1, .1 + .1 * smoothstep(.7, 1.3, diagTLtoBR));
142
-
143
- vec2 grad_uv = uv - .5;
144
-
145
- float dist = length(grad_uv + vec2(0., .2 * diagBLtoTR));
146
- grad_uv = rotate(grad_uv, (.25 - .2 * diagBLtoTR) * PI);
147
- float direction = grad_uv.x;
148
-
149
- float bump = pow(1.8 * dist, 1.2);
150
- bump = 1. - bump;
151
- bump *= pow(uv.y, .3);
152
-
153
-
154
- float thin_strip_1_ratio = .12 / cycleWidth * (1. - .4 * bump);
155
- float thin_strip_2_ratio = .07 / cycleWidth * (1. + .4 * bump);
156
- float wide_strip_ratio = (1. - thin_strip_1_ratio - thin_strip_2_ratio);
157
-
158
- float thin_strip_1_width = cycleWidth * thin_strip_1_ratio;
159
- float thin_strip_2_width = cycleWidth * thin_strip_2_ratio;
160
-
161
- float noise = snoise(uv - t);
162
-
163
- mask += (1. - mask) * u_distortion * noise;
164
-
165
- direction += diagBLtoTR;
166
-
167
- float contour = u_contour * smoothstep(0., contOffset, mask) * smoothstep(contOffset, 0., mask);
168
- direction -= 14. * noise * contour;
169
-
170
- bump *= clamp(pow(uv.y, .1), .3, 1.);
171
- direction *= (.1 + (1.1 - mask) * bump);
172
- direction *= smoothstep(1., .2, mask);
173
-
174
-
175
- direction *= (.5 + .5 * pow(uv.y, 2.));
176
- direction *= cycleWidth;
177
- direction -= t;
178
-
179
-
180
- float colorDispersion = (1. - bump);
181
- float dispersionRed = colorDispersion;
182
- dispersionRed += bump * noise;
183
- float dispersionBlue = colorDispersion;
184
-
185
- dispersionRed *= (u_shiftRed / 20.);
186
- dispersionBlue *= (u_shiftBlue / 20.);
187
-
188
- float blur = u_softness / 15. + .3 * contour;
189
-
190
- vec3 w = vec3(thin_strip_1_width, thin_strip_2_width, wide_strip_ratio);
191
- w[1] -= .02 * smoothstep(.0, 1., mask + bump);
192
- float stripe_r = mod(direction + dispersionRed, 1.);
193
- float r = getColorChanges(color1.r, color2.r, stripe_r, w, blur, bump, u_colorTint.r);
194
- float stripe_g = mod(direction, 1.);
195
- float g = getColorChanges(color1.g, color2.g, stripe_g, w, blur, bump, u_colorTint.g);
196
- float stripe_b = mod(direction - dispersionBlue, 1.);
197
- float b = getColorChanges(color1.b, color2.b, stripe_b, w, blur, bump, u_colorTint.b);
198
-
199
- color = vec3(r, g, b);
200
- color *= opacity;
201
-
202
- vec3 bgColor = u_colorBack.rgb * u_colorBack.a;
203
- color = color + bgColor * (1. - opacity);
204
- opacity = opacity + u_colorBack.a * (1. - opacity);
205
-
206
- ${colorBandingFix}
207
-
208
- fragColor = vec4(color, opacity);
209
- }
210
- `;
211
- const LiquidMetalShapes = {
212
- none: 0,
213
- circle: 1,
214
- daisy: 2,
215
- metaballs: 3
216
- };
217
- export {
218
- LiquidMetalShapes,
219
- liquidMetalFragmentShader
220
- };
221
- //# sourceMappingURL=liquid-metal.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shaders/liquid-metal.ts"],
4
- "sourcesContent": ["import type { ShaderMotionParams } from '../shader-mount';\nimport { sizingVariablesDeclaration, type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing';\nimport { declarePI, declareRotate, declareSimplexNoise, colorBandingFix } from '../shader-utils';\n\n/**\n */\n\nexport const liquidMetalFragmentShader: string = `#version 300 es\nprecision mediump float;\n\nuniform float u_time;\n\nuniform vec4 u_colorBack;\nuniform vec4 u_colorTint;\n\nuniform float u_softness;\nuniform float u_repetition;\nuniform float u_shiftRed;\nuniform float u_shiftBlue;\nuniform float u_distortion;\nuniform float u_contour;\nuniform float u_shape;\n\n${sizingVariablesDeclaration}\n\nout vec4 fragColor;\n\n${declarePI}\n${declareRotate}\n${declareSimplexNoise}\n\nfloat getColorChanges(float c1, float c2, float stripe_p, vec3 w, float blur, float bump, float tint) {\n\n float ch = mix(c2, c1, smoothstep(.0, blur, stripe_p));\n\n float border = w[0];\n ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + .4 * (1. - bump) * w[1];\n ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + .5 * (1. - bump) * w[1];\n ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + w[1];\n ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));\n\n float gradient_t = (stripe_p - w[0] - w[1]) / w[2];\n float gradient = mix(c1, c2, smoothstep(0., 1., gradient_t));\n ch = mix(ch, gradient, smoothstep(border - blur, border + blur, stripe_p));\n \n // ch = 1. - min(1., (1. - ch) / max(tint, .0001));\n ch = mix(ch, 1. - min(1., (1. - ch) / max(tint, 0.0001)), u_colorTint.a);\n return ch;\n}\n\nvoid main() {\n\n float t = .1 * u_time;\n\n vec2 uv = v_objectUV;\n uv += .5;\n uv.y = 1. - uv.y;\n\n float cycleWidth = .5 * u_repetition;\n\n float mask = 1.;\n float contOffset = 1.;\n\n if (u_shape < 1.) {\n\n vec2 borderUV = v_responsiveUV + .5;\n float ratio = v_responsiveBoxGivenSize.x / v_responsiveBoxGivenSize.y;\n vec2 edge = min(borderUV, 1. - borderUV);\n vec2 pixel_thickness = 250. / v_responsiveBoxGivenSize;\n float maskX = smoothstep(0.0, pixel_thickness.x, edge.x);\n float maskY = smoothstep(0.0, pixel_thickness.y, edge.y);\n maskX = pow(maskX, .25);\n maskY = pow(maskY, .25);\n mask = clamp(1. - maskX * maskY, 0., 1.);\n\n uv = v_responsiveUV;\n if (ratio > 1.) {\n uv.y /= ratio;\n } else {\n uv.x *= ratio;\n }\n uv += .5;\n uv.y = 1. - uv.y;\n\n cycleWidth *= 2.;\n contOffset = 1.5;\n\n } else if (u_shape < 2.) {\n vec2 shapeUV = uv - .5;\n shapeUV *= .67;\n mask = pow(clamp(3. * length(shapeUV), 0., 1.), 18.);\n } else if (u_shape < 3.) {\n vec2 shapeUV = uv - .5;\n shapeUV *= 1.68;\n\n float r = length(shapeUV) * 2.;\n float a = atan(shapeUV.y, shapeUV.x) + .2;\n r *= (1. + .05 * sin(3. * a + 2. * t));\n float f = abs(cos(a * 3.));\n mask = smoothstep(f, f + .7, r);\n mask = pow(mask, 2.);\n\n uv *= .8;\n cycleWidth *= 1.6;\n\n } else if (u_shape < 4.) {\n vec2 shapeUV = uv - .5;\n shapeUV *= 1.3;\n mask = 0.;\n for (int i = 0; i < 5; i++) {\n float fi = float(i);\n float speed = 4.5 + 2. * sin(fi * 12.345);\n float angle = -fi * 1.5;\n vec2 dir1 = vec2(cos(angle), sin(angle));\n vec2 dir2 = vec2(cos(angle + 1.57), sin(angle + 1.));\n vec2 traj = .4 * (dir1 * sin(t * speed + fi * 1.23) + dir2 * cos(t * (speed * 0.7) + fi * 2.17));\n float d = length(shapeUV + traj);\n mask += pow(1.0 - clamp(d, 0.0, 1.0), 4.0);\n }\n mask = 1. - smoothstep(.65, .9, mask);\n mask = pow(mask, 4.);\n }\n\n float opacity = 1. - smoothstep(.8, .82, mask);\n\n float ridge = .15 * (smoothstep(.0, .15, uv.y) * smoothstep(.4, .15, uv.y));\n ridge += .05 * (smoothstep(.1, .2, 1. - uv.y) * smoothstep(.4, .2, 1. - uv.y));\n mask += ridge;\n\n float diagBLtoTR = uv.x - uv.y;\n float diagTLtoBR = uv.x + uv.y;\n\n vec3 color = vec3(0.);\n vec3 color1 = vec3(.98, 0.98, 1.);\n vec3 color2 = vec3(.1, .1, .1 + .1 * smoothstep(.7, 1.3, diagTLtoBR));\n\n vec2 grad_uv = uv - .5;\n\n float dist = length(grad_uv + vec2(0., .2 * diagBLtoTR));\n grad_uv = rotate(grad_uv, (.25 - .2 * diagBLtoTR) * PI);\n float direction = grad_uv.x;\n\n float bump = pow(1.8 * dist, 1.2);\n bump = 1. - bump;\n bump *= pow(uv.y, .3);\n\n\n float thin_strip_1_ratio = .12 / cycleWidth * (1. - .4 * bump);\n float thin_strip_2_ratio = .07 / cycleWidth * (1. + .4 * bump);\n float wide_strip_ratio = (1. - thin_strip_1_ratio - thin_strip_2_ratio);\n\n float thin_strip_1_width = cycleWidth * thin_strip_1_ratio;\n float thin_strip_2_width = cycleWidth * thin_strip_2_ratio;\n\n float noise = snoise(uv - t);\n\n mask += (1. - mask) * u_distortion * noise;\n\n direction += diagBLtoTR;\n\n float contour = u_contour * smoothstep(0., contOffset, mask) * smoothstep(contOffset, 0., mask);\n direction -= 14. * noise * contour;\n\n bump *= clamp(pow(uv.y, .1), .3, 1.);\n direction *= (.1 + (1.1 - mask) * bump);\n direction *= smoothstep(1., .2, mask);\n\n\n direction *= (.5 + .5 * pow(uv.y, 2.));\n direction *= cycleWidth;\n direction -= t;\n\n\n float colorDispersion = (1. - bump);\n float dispersionRed = colorDispersion;\n dispersionRed += bump * noise;\n float dispersionBlue = colorDispersion;\n\n dispersionRed *= (u_shiftRed / 20.);\n dispersionBlue *= (u_shiftBlue / 20.);\n\n float blur = u_softness / 15. + .3 * contour;\n\n vec3 w = vec3(thin_strip_1_width, thin_strip_2_width, wide_strip_ratio);\n w[1] -= .02 * smoothstep(.0, 1., mask + bump);\n float stripe_r = mod(direction + dispersionRed, 1.);\n float r = getColorChanges(color1.r, color2.r, stripe_r, w, blur, bump, u_colorTint.r);\n float stripe_g = mod(direction, 1.);\n float g = getColorChanges(color1.g, color2.g, stripe_g, w, blur, bump, u_colorTint.g);\n float stripe_b = mod(direction - dispersionBlue, 1.);\n float b = getColorChanges(color1.b, color2.b, stripe_b, w, blur, bump, u_colorTint.b);\n\n color = vec3(r, g, b);\n color *= opacity;\n \n vec3 bgColor = u_colorBack.rgb * u_colorBack.a;\n color = color + bgColor * (1. - opacity);\n opacity = opacity + u_colorBack.a * (1. - opacity);\n\n ${colorBandingFix}\n\n fragColor = vec4(color, opacity);\n}\n`;\n\nexport interface LiquidMetalUniforms extends ShaderSizingUniforms {\n u_colorBack: [number, number, number, number];\n u_colorTint: [number, number, number, number];\n u_softness: number;\n u_repetition: number;\n u_shiftRed: number;\n u_shiftBlue: number;\n u_distortion: number;\n u_contour: number;\n u_shape: (typeof LiquidMetalShapes)[LiquidMetalShape];\n}\n\nexport interface LiquidMetalParams extends ShaderSizingParams, ShaderMotionParams {\n colorBack?: string;\n colorTint?: string;\n softness?: number;\n repetition?: number;\n shiftRed?: number;\n shiftBlue?: number;\n distortion?: number;\n contour?: number;\n shape?: LiquidMetalShape;\n}\n\nexport const LiquidMetalShapes = {\n none: 0,\n circle: 1,\n daisy: 2,\n metaballs: 3,\n} as const;\n\nexport type LiquidMetalShape = keyof typeof LiquidMetalShapes;\n"],
5
- "mappings": ";;;;;AACA,SAAS,kCAAsF;AAC/F,SAAS,WAAW,eAAe,qBAAqB,uBAAuB;AAKxE,MAAM,4BAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB/C,0BAA0B;AAAA;AAAA;AAAA;AAAA,EAI1B,SAAS;AAAA,EACT,aAAa;AAAA,EACb,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgLjB,eAAe;AAAA;AAAA;AAAA;AAAA;AA8BZ,MAAM,oBAAoB;AAAA,EAC/B,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACb;",
6
- "names": []
7
- }
@@ -1,97 +0,0 @@
1
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
- * Paper Shaders *
3
- * https://github.com/paper-design/shaders *
4
- * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5
-
6
- import { sizingVariablesDeclaration } from "../shader-sizing";
7
- import { declarePI, declareRotate, colorBandingFix } from "../shader-utils";
8
- const meshGradientMeta = {
9
- maxColorCount: 10
10
- };
11
- const meshGradientFragmentShader = `#version 300 es
12
- precision mediump float;
13
-
14
- uniform float u_time;
15
-
16
- uniform vec4 u_colors[${meshGradientMeta.maxColorCount}];
17
- uniform float u_colorsCount;
18
-
19
- uniform float u_distortion;
20
- uniform float u_swirl;
21
-
22
- ${sizingVariablesDeclaration}
23
-
24
- out vec4 fragColor;
25
-
26
- ${declarePI}
27
- ${declareRotate}
28
-
29
- vec2 getPosition(int i, float t) {
30
- float a = float(i) * .37;
31
- float b = .6 + mod(float(i), 3.) * .3;
32
- float c = .8 + mod(float(i + 1), 4.) * 0.25;
33
-
34
- float x = sin(t * b + a);
35
- float y = cos(t * c + a * 1.5);
36
-
37
- return .5 + .5 * vec2(x, y);
38
- }
39
-
40
- void main() {
41
- vec2 shape_uv = v_objectUV;
42
-
43
- shape_uv += .5;
44
-
45
- float t = .5 * u_time;
46
-
47
- float radius = smoothstep(0., 1., length(shape_uv - .5));
48
- float center = 1. - radius;
49
- for (float i = 1.; i <= 2.; i++) {
50
- shape_uv.x += u_distortion * center / i * sin(t + i * .4 * smoothstep(.0, 1., shape_uv.y)) * cos(.2 * t + i * 2.4 * smoothstep(.0, 1., shape_uv.y));
51
- shape_uv.y += u_distortion * center / i * cos(t + i * 2. * smoothstep(.0, 1., shape_uv.x));
52
- }
53
-
54
- vec2 uvRotated = shape_uv;
55
- uvRotated -= vec2(.5);
56
- float angle = 3. * u_swirl * radius;
57
- uvRotated = rotate(uvRotated, -angle);
58
- uvRotated += vec2(.5);
59
-
60
- vec3 color = vec3(0.);
61
- float opacity = 0.;
62
- float totalWeight = 0.;
63
-
64
- for (int i = 0; i < ${meshGradientMeta.maxColorCount}; i++) {
65
- if (i >= int(u_colorsCount)) break;
66
-
67
- vec2 pos = getPosition(i, t);
68
- vec3 colorFraction = u_colors[i].rgb * u_colors[i].a;
69
- float opacityFraction = u_colors[i].a;
70
-
71
- float dist = 0.;
72
- if (mod(float(i), 2.) > 1.) {
73
- dist = length(shape_uv - pos);
74
- } else {
75
- dist = length(uvRotated - pos);
76
- }
77
-
78
- dist = pow(dist, 3.5);
79
- float weight = 1. / (dist + 1e-3);
80
- color += colorFraction * weight;
81
- opacity += opacityFraction * weight;
82
- totalWeight += weight;
83
- }
84
-
85
- color /= totalWeight;
86
- opacity /= totalWeight;
87
-
88
- ${colorBandingFix}
89
-
90
- fragColor = vec4(color, opacity);
91
- }
92
- `;
93
- export {
94
- meshGradientFragmentShader,
95
- meshGradientMeta
96
- };
97
- //# sourceMappingURL=mesh-gradient.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shaders/mesh-gradient.ts"],
4
- "sourcesContent": ["import type { vec4 } from '../types';\nimport type { ShaderMotionParams } from '../shader-mount';\nimport { sizingVariablesDeclaration, type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing';\nimport { declarePI, declareRotate, colorBandingFix } from '../shader-utils';\n\nexport const meshGradientMeta = {\n maxColorCount: 10,\n} as const;\n\n/**\n * Mesh Gradient Ksenia Kondrashova\n * Smooth, animated mesh gradient using a dynamic list of colors\n *\n * Uniforms include:\n * - u_colors (vec4[]): Input RGBA colors\n * - u_colorsCount (float): Number of active colors (`u_colors` length)\n * - u_distortion (float): Amount of animated wavy distortion applied to UV coordinates\n * - u_swirl (float): Amount of radial swirl distortion applied to UV coordinates\n */\nexport const meshGradientFragmentShader: string = `#version 300 es\nprecision mediump float;\n\nuniform float u_time;\n\nuniform vec4 u_colors[${meshGradientMeta.maxColorCount}];\nuniform float u_colorsCount;\n\nuniform float u_distortion;\nuniform float u_swirl;\n\n${sizingVariablesDeclaration}\n\nout vec4 fragColor;\n\n${declarePI}\n${declareRotate}\n\nvec2 getPosition(int i, float t) {\n float a = float(i) * .37;\n float b = .6 + mod(float(i), 3.) * .3;\n float c = .8 + mod(float(i + 1), 4.) * 0.25;\n\n float x = sin(t * b + a);\n float y = cos(t * c + a * 1.5);\n\n return .5 + .5 * vec2(x, y);\n}\n\nvoid main() {\n vec2 shape_uv = v_objectUV;\n\n shape_uv += .5;\n\n float t = .5 * u_time;\n\n float radius = smoothstep(0., 1., length(shape_uv - .5));\n float center = 1. - radius;\n for (float i = 1.; i <= 2.; i++) {\n shape_uv.x += u_distortion * center / i * sin(t + i * .4 * smoothstep(.0, 1., shape_uv.y)) * cos(.2 * t + i * 2.4 * smoothstep(.0, 1., shape_uv.y));\n shape_uv.y += u_distortion * center / i * cos(t + i * 2. * smoothstep(.0, 1., shape_uv.x));\n }\n\n vec2 uvRotated = shape_uv;\n uvRotated -= vec2(.5);\n float angle = 3. * u_swirl * radius;\n uvRotated = rotate(uvRotated, -angle);\n uvRotated += vec2(.5);\n\n vec3 color = vec3(0.);\n float opacity = 0.;\n float totalWeight = 0.;\n \n for (int i = 0; i < ${meshGradientMeta.maxColorCount}; i++) {\n if (i >= int(u_colorsCount)) break;\n \n vec2 pos = getPosition(i, t);\n vec3 colorFraction = u_colors[i].rgb * u_colors[i].a;\n float opacityFraction = u_colors[i].a;\n \n float dist = 0.;\n if (mod(float(i), 2.) > 1.) {\n dist = length(shape_uv - pos);\n } else {\n dist = length(uvRotated - pos);\n }\n\n dist = pow(dist, 3.5);\n float weight = 1. / (dist + 1e-3);\n color += colorFraction * weight;\n opacity += opacityFraction * weight;\n totalWeight += weight;\n }\n\n color /= totalWeight;\n opacity /= totalWeight;\n \n ${colorBandingFix}\n\n fragColor = vec4(color, opacity);\n}\n`;\n\nexport interface MeshGradientUniforms extends ShaderSizingUniforms {\n u_colors: vec4[];\n u_colorsCount: number;\n u_distortion: number;\n u_swirl: number;\n}\n\nexport interface MeshGradientParams extends ShaderSizingParams, ShaderMotionParams {\n colors?: string[];\n distortion?: number;\n swirl?: number;\n}\n"],
5
- "mappings": ";;;;;AAEA,SAAS,kCAAsF;AAC/F,SAAS,WAAW,eAAe,uBAAuB;AAEnD,MAAM,mBAAmB;AAAA,EAC9B,eAAe;AACjB;AAYO,MAAM,6BAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,wBAK1B,iBAAiB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpD,0BAA0B;AAAA;AAAA;AAAA;AAAA,EAI1B,SAAS;AAAA,EACT,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAqCS,iBAAiB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAwBlD,eAAe;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,110 +0,0 @@
1
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
- * Paper Shaders *
3
- * https://github.com/paper-design/shaders *
4
- * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5
-
6
- import { sizingVariablesDeclaration } from "../shader-sizing";
7
- import { declarePI, colorBandingFix } from "../shader-utils";
8
- const metaballsMeta = {
9
- maxColorCount: 8,
10
- maxBallsCount: 20
11
- };
12
- const metaballsFragmentShader = `#version 300 es
13
- precision mediump float;
14
-
15
- uniform float u_time;
16
-
17
- uniform vec4 u_colorBack;
18
- uniform vec4 u_colors[${metaballsMeta.maxColorCount}];
19
- uniform float u_colorsCount;
20
- uniform float u_size;
21
- uniform float u_sizeRange;
22
- uniform float u_count;
23
-
24
- ${sizingVariablesDeclaration}
25
-
26
- out vec4 fragColor;
27
-
28
- ${declarePI}
29
-
30
- float hash(float x) {
31
- return fract(sin(x) * 43758.5453123);
32
- }
33
- float noise(float x) {
34
- float i = floor(x);
35
- float f = fract(x);
36
- float u = f * f * (3.0 - 2.0 * f);
37
- return mix(hash(i), hash(i + 1.0), u);
38
- }
39
-
40
- float getBallShape(vec2 uv, vec2 c, float p) {
41
- float s = .5 * length(uv - c);
42
- s = 1. - clamp(s, 0., 1.);
43
- s = pow(s, p);
44
- return s;
45
- }
46
-
47
- void main() {
48
- vec2 shape_uv = v_objectUV;
49
-
50
- shape_uv += .5;
51
-
52
- float t = .2 * u_time + 1.;
53
-
54
- vec3 totalColor = vec3(0.);
55
- float totalShape = 0.;
56
- float totalOpacity = 0.;
57
-
58
- for (int i = 0; i < ${metaballsMeta.maxBallsCount}; i++) {
59
- if (i >= int(ceil(u_count))) break;
60
-
61
- float idxFract = float(i) / float(${metaballsMeta.maxBallsCount});
62
- float angle = TWO_PI * idxFract;
63
-
64
- float speed = 1. - .2 * idxFract;
65
- float noiseX = noise(angle * 10. + float(i) + t * speed);
66
- float noiseY = noise(angle * 20. + float(i) - t * speed);
67
-
68
- vec2 pos = vec2(.5) + 1e-4 + .9 * (vec2(noiseX, noiseY) - .5);
69
-
70
- int safeIndex = i % int(u_colorsCount + 0.5);
71
- vec4 ballColor = u_colors[safeIndex];
72
- ballColor.rgb *= ballColor.a;
73
-
74
- float sizeFrac = 1.;
75
- if (float(i) > floor(u_count - 1.)) {
76
- sizeFrac *= fract(u_count);
77
- }
78
-
79
- float shape = getBallShape(shape_uv, pos, 45. - 30. * u_size * sizeFrac);
80
- shape *= pow(u_size, .2);
81
- shape = smoothstep(0., 1., shape);
82
-
83
- totalColor += ballColor.rgb * shape;
84
- totalShape += shape;
85
- totalOpacity += ballColor.a * shape;
86
- }
87
-
88
- totalColor /= max(totalShape, 1e-4);
89
- totalOpacity /= max(totalShape, 1e-4);
90
-
91
- float edge_width = fwidth(totalShape);
92
- float finalShape = smoothstep(.4, .4 + edge_width, totalShape);
93
-
94
- vec3 color = totalColor * finalShape;
95
- float opacity = totalOpacity * finalShape;
96
-
97
- vec3 bgColor = u_colorBack.rgb * u_colorBack.a;
98
- color = color + bgColor * (1. - opacity);
99
- opacity = opacity + u_colorBack.a * (1. - opacity);
100
-
101
- ${colorBandingFix}
102
-
103
- fragColor = vec4(color, opacity);
104
- }
105
- `;
106
- export {
107
- metaballsFragmentShader,
108
- metaballsMeta
109
- };
110
- //# sourceMappingURL=metaballs.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shaders/metaballs.ts"],
4
- "sourcesContent": ["import type { vec4 } from '../types';\nimport type { ShaderMotionParams } from '../shader-mount';\nimport { sizingVariablesDeclaration, type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing';\nimport { declarePI, colorBandingFix } from '../shader-utils';\n\nexport const metaballsMeta = {\n maxColorCount: 8,\n maxBallsCount: 20,\n} as const;\n\n/**\n * Metaballs (circular shapes with gooey effect applied)\n * The artwork by Ksenia Kondrashova\n *\n * Uniforms include:\n * - u_colorBack: the background color of the scene\n * - uColors (vec4[]): Input RGBA colors\n * - uColorsCount (float): Number of active colors (`uColors` length)\n * - u_count (float)\n * - u_size (float)\n */\nexport const metaballsFragmentShader: string = `#version 300 es\nprecision mediump float;\n\nuniform float u_time;\n\nuniform vec4 u_colorBack;\nuniform vec4 u_colors[${metaballsMeta.maxColorCount}];\nuniform float u_colorsCount;\nuniform float u_size;\nuniform float u_sizeRange;\nuniform float u_count;\n\n${sizingVariablesDeclaration}\n\nout vec4 fragColor;\n\n${declarePI}\n\nfloat hash(float x) {\n return fract(sin(x) * 43758.5453123);\n}\nfloat noise(float x) {\n float i = floor(x);\n float f = fract(x);\n float u = f * f * (3.0 - 2.0 * f);\n return mix(hash(i), hash(i + 1.0), u);\n}\n\nfloat getBallShape(vec2 uv, vec2 c, float p) {\n float s = .5 * length(uv - c);\n s = 1. - clamp(s, 0., 1.);\n s = pow(s, p);\n return s;\n}\n\nvoid main() {\n vec2 shape_uv = v_objectUV;\n\n shape_uv += .5;\n\n float t = .2 * u_time + 1.;\n\n vec3 totalColor = vec3(0.);\n float totalShape = 0.;\n float totalOpacity = 0.;\n \n for (int i = 0; i < ${metaballsMeta.maxBallsCount}; i++) {\n if (i >= int(ceil(u_count))) break;\n \n float idxFract = float(i) / float(${metaballsMeta.maxBallsCount});\n float angle = TWO_PI * idxFract;\n \n float speed = 1. - .2 * idxFract;\n float noiseX = noise(angle * 10. + float(i) + t * speed);\n float noiseY = noise(angle * 20. + float(i) - t * speed);\n \n vec2 pos = vec2(.5) + 1e-4 + .9 * (vec2(noiseX, noiseY) - .5);\n \n int safeIndex = i % int(u_colorsCount + 0.5);\n vec4 ballColor = u_colors[safeIndex];\n ballColor.rgb *= ballColor.a;\n\n float sizeFrac = 1.;\n if (float(i) > floor(u_count - 1.)) {\n sizeFrac *= fract(u_count);\n }\n\n float shape = getBallShape(shape_uv, pos, 45. - 30. * u_size * sizeFrac);\n shape *= pow(u_size, .2);\n shape = smoothstep(0., 1., shape);\n\n totalColor += ballColor.rgb * shape;\n totalShape += shape;\n totalOpacity += ballColor.a * shape;\n }\n\n totalColor /= max(totalShape, 1e-4);\n totalOpacity /= max(totalShape, 1e-4);\n\n float edge_width = fwidth(totalShape);\n float finalShape = smoothstep(.4, .4 + edge_width, totalShape);\n\n vec3 color = totalColor * finalShape;\n float opacity = totalOpacity * finalShape;\n\n vec3 bgColor = u_colorBack.rgb * u_colorBack.a;\n color = color + bgColor * (1. - opacity);\n opacity = opacity + u_colorBack.a * (1. - opacity);\n\n ${colorBandingFix}\n\n fragColor = vec4(color, opacity);\n}\n`;\n\nexport interface MetaballsUniforms extends ShaderSizingUniforms {\n u_colorBack: [number, number, number, number];\n u_colors: vec4[];\n u_colorsCount: number;\n u_count: number;\n u_size: number;\n}\n\nexport interface MetaballsParams extends ShaderSizingParams, ShaderMotionParams {\n colorBack?: string;\n colors?: string[];\n count?: number;\n size?: number;\n}\n"],
5
- "mappings": ";;;;;AAEA,SAAS,kCAAsF;AAC/F,SAAS,WAAW,uBAAuB;AAEpC,MAAM,gBAAgB;AAAA,EAC3B,eAAe;AAAA,EACf,eAAe;AACjB;AAaO,MAAM,0BAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMvB,cAAc,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjD,0BAA0B;AAAA;AAAA;AAAA;AAAA,EAI1B,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBA8Ba,cAAc,aAAa;AAAA;AAAA;AAAA,wCAGX,cAAc,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAwC/D,eAAe;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,81 +0,0 @@
1
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
- * Paper Shaders *
3
- * https://github.com/paper-design/shaders *
4
- * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5
-
6
- import { sizingVariablesDeclaration } from "../shader-sizing";
7
- import { declareRotate, colorBandingFix } from "../shader-utils";
8
- const neuroNoiseFragmentShader = `#version 300 es
9
- precision mediump float;
10
-
11
- uniform float u_time;
12
- uniform vec2 u_resolution;
13
- uniform float u_pixelRatio;
14
-
15
- uniform vec4 u_colorFront;
16
- uniform vec4 u_colorMid;
17
- uniform vec4 u_colorBack;
18
- uniform float u_brightness;
19
- uniform float u_contrast;
20
-
21
-
22
- ${sizingVariablesDeclaration}
23
-
24
- out vec4 fragColor;
25
-
26
- ${declareRotate}
27
-
28
- float neuroShape(vec2 uv, float t) {
29
- vec2 sine_acc = vec2(0.);
30
- vec2 res = vec2(0.);
31
- float scale = 8.;
32
-
33
- for (int j = 0; j < 15; j++) {
34
- uv = rotate(uv, 1.);
35
- sine_acc = rotate(sine_acc, 1.);
36
- vec2 layer = uv * scale + float(j) + sine_acc - t;
37
- sine_acc += sin(layer);
38
- res += (.5 + .5 * cos(layer)) / scale;
39
- scale *= (1.2);
40
- }
41
- return res.x + res.y;
42
- }
43
-
44
- void main() {
45
- vec2 shape_uv = v_patternUV;
46
-
47
- shape_uv *= .0013;
48
-
49
- float t = .5 * u_time;
50
-
51
- float noise = neuroShape(shape_uv, t);
52
-
53
- noise = (1. + u_brightness) * pow(noise, 2.);
54
- noise = pow(noise, .7 + 6. * u_contrast);
55
- noise = min(1.4, noise);
56
-
57
- float blend = smoothstep(0.7, 1.4, noise);
58
-
59
- vec4 frontC = u_colorFront;
60
- frontC.rgb *= frontC.a;
61
- vec4 midC = u_colorMid;
62
- midC.rgb *= midC.a;
63
- vec4 blendFront = mix(midC, frontC, blend);
64
-
65
- float safeNoise = max(noise, 0.0);
66
- vec3 color = blendFront.rgb * safeNoise;
67
- float opacity = clamp(blendFront.a * safeNoise, 0., 1.);
68
-
69
- vec3 bgColor = u_colorBack.rgb * u_colorBack.a;
70
- color = color + bgColor * (1. - opacity);
71
- opacity = opacity + u_colorBack.a * (1. - opacity);
72
-
73
- ${colorBandingFix}
74
-
75
- fragColor = vec4(color, opacity);
76
- }
77
- `;
78
- export {
79
- neuroNoiseFragmentShader
80
- };
81
- //# sourceMappingURL=neuro-noise.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shaders/neuro-noise.ts"],
4
- "sourcesContent": ["import type { ShaderMotionParams } from '../shader-mount';\nimport { sizingVariablesDeclaration, type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing';\nimport { declareRotate, colorBandingFix } from '../shader-utils';\n\n/**\n * Neuro Noise Pattern\n * Original algo: https://x.com/zozuar/status/1625182758745128981/\n * Renders a fractal-like structure made of several layers of since-arches\n *\n * Uniforms include:\n * u_colorFront - the highlights (overexposed noise areas)\n * u_colorMid - the base color of pattern\n * u_colorBack - the backgrond color of pattern\n * u_brightness - increase/decrease the weight of strong lines\n * u_contrast - show/hide the weak pattern lines\n */\nexport const neuroNoiseFragmentShader: string = `#version 300 es\nprecision mediump float;\n\nuniform float u_time;\nuniform vec2 u_resolution;\nuniform float u_pixelRatio;\n\nuniform vec4 u_colorFront;\nuniform vec4 u_colorMid;\nuniform vec4 u_colorBack;\nuniform float u_brightness;\nuniform float u_contrast;\n\n\n${sizingVariablesDeclaration}\n\nout vec4 fragColor;\n\n${declareRotate}\n\nfloat neuroShape(vec2 uv, float t) {\n vec2 sine_acc = vec2(0.);\n vec2 res = vec2(0.);\n float scale = 8.;\n\n for (int j = 0; j < 15; j++) {\n uv = rotate(uv, 1.);\n sine_acc = rotate(sine_acc, 1.);\n vec2 layer = uv * scale + float(j) + sine_acc - t;\n sine_acc += sin(layer);\n res += (.5 + .5 * cos(layer)) / scale;\n scale *= (1.2);\n }\n return res.x + res.y;\n}\n\nvoid main() {\n vec2 shape_uv = v_patternUV;\n\n shape_uv *= .0013;\n\n float t = .5 * u_time;\n\n float noise = neuroShape(shape_uv, t);\n\n noise = (1. + u_brightness) * pow(noise, 2.);\n noise = pow(noise, .7 + 6. * u_contrast);\n noise = min(1.4, noise);\n \n float blend = smoothstep(0.7, 1.4, noise);\n\n vec4 frontC = u_colorFront;\n frontC.rgb *= frontC.a;\n vec4 midC = u_colorMid;\n midC.rgb *= midC.a;\n vec4 blendFront = mix(midC, frontC, blend);\n\n float safeNoise = max(noise, 0.0);\n vec3 color = blendFront.rgb * safeNoise;\n float opacity = clamp(blendFront.a * safeNoise, 0., 1.);\n \n vec3 bgColor = u_colorBack.rgb * u_colorBack.a;\n color = color + bgColor * (1. - opacity);\n opacity = opacity + u_colorBack.a * (1. - opacity);\n \n ${colorBandingFix}\n\n fragColor = vec4(color, opacity);\n}\n`;\n\nexport interface NeuroNoiseUniforms extends ShaderSizingUniforms {\n u_colorFront: [number, number, number, number];\n u_colorMid: [number, number, number, number];\n u_colorBack: [number, number, number, number];\n u_brightness: number;\n u_contrast: number;\n}\n\nexport interface NeuroNoiseParams extends ShaderSizingParams, ShaderMotionParams {\n colorFront?: string;\n colorMid?: string;\n colorBack?: string;\n brightness?: number;\n contrast?: number;\n}\n"],
5
- "mappings": ";;;;;AACA,SAAS,kCAAsF;AAC/F,SAAS,eAAe,uBAAuB;AAcxC,MAAM,2BAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc9C,0BAA0B;AAAA;AAAA;AAAA;AAAA,EAI1B,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA+CX,eAAe;AAAA;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }