@paper-design/shaders 0.0.25 → 0.0.26

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/dist/index.js CHANGED
@@ -1,11 +1,329 @@
1
1
  /***** Paper Shaders: https://github.com/paper-design/shaders *****/
2
- function y(o){return"paperShaderMount"in o}var x=class{mountToDiv;canvas;gl;program=null;uniformLocations={};fragmentShader;rafId=null;lastRenderTime=0;totalFrameTime=0;speed=0;providedUniforms;hasBeenDisposed=!1;resolutionChanged=!0;textures=new Map;maxResolution=0;constructor(e,t,r={},i,a=0,s=0,u=1920){let n=document.createElement("canvas");e.style.contain="strict",e.style.position="relative",n.style.position="absolute",n.style.inset="0",n.style.zIndex="-1",n.style.width="100%",n.style.height="100%",this.canvas=n,this.mountToDiv=e,e.appendChild(n),this.fragmentShader=t,this.providedUniforms=r,this.totalFrameTime=s,this.maxResolution=u;let l=n.getContext("webgl2",i);if(!l)throw new Error("WebGL not supported");this.gl=l,this.initProgram(),this.setupPositionAttribute(),this.setupUniforms(),this.setUniformValues(this.providedUniforms),this.setupResizeObserver(),this.setSpeed(a),this.canvas.setAttribute("data-paper-shaders","true"),this.mountToDiv.paperShaderMount=this}initProgram=()=>{let e=R(this.gl,S,this.fragmentShader);e&&(this.program=e)};setupPositionAttribute=()=>{let e=this.gl.getAttribLocation(this.program,"a_position"),t=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,t);let r=[-1,-1,1,-1,-1,1,-1,1,1,-1,1,1];this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(r),this.gl.STATIC_DRAW),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,0,0)};setupUniforms=()=>{let e={u_time:this.gl.getUniformLocation(this.program,"u_time"),u_pixelRatio:this.gl.getUniformLocation(this.program,"u_pixelRatio"),u_resolution:this.gl.getUniformLocation(this.program,"u_resolution")};Object.entries(this.providedUniforms).forEach(([t,r])=>{if(e[t]=this.gl.getUniformLocation(this.program,t),r instanceof HTMLImageElement){let i=`${t}_aspect_ratio`;e[i]=this.gl.getUniformLocation(this.program,i)}}),this.uniformLocations=e};resizeObserver=null;setupResizeObserver=()=>{this.resizeObserver=new ResizeObserver(()=>this.handleResize()),this.resizeObserver.observe(this.mountToDiv),this.handleResize()};renderScale=1;handleResize=()=>{let e=this.mountToDiv.clientWidth,t=this.mountToDiv.clientHeight,r=this.maxResolution,i=Math.max(2,window.devicePixelRatio);this.renderScale=Math.min(1,r/Math.max(e,t))*i;let a=e*this.renderScale,s=t*this.renderScale;(this.canvas.width!==a||this.canvas.height!==s)&&(this.canvas.width=a,this.canvas.height=s,this.resolutionChanged=!0,this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.render(performance.now()))};render=e=>{if(this.hasBeenDisposed)return;if(this.program===null){console.warn("Tried to render before program or gl was initialized");return}let t=e-this.lastRenderTime;this.lastRenderTime=e,this.speed!==0&&(this.totalFrameTime+=t*this.speed),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.useProgram(this.program),this.gl.uniform1f(this.uniformLocations.u_time,this.totalFrameTime*.001),this.resolutionChanged&&(this.gl.uniform2f(this.uniformLocations.u_resolution,this.gl.canvas.width,this.gl.canvas.height),this.gl.uniform1f(this.uniformLocations.u_pixelRatio,this.renderScale),this.resolutionChanged=!1),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.speed!==0?this.requestRender():this.rafId=null};requestRender=()=>{this.rafId!==null&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(this.render)};setTextureUniform=(e,t)=>{if(!t.complete||t.naturalWidth===0)throw new Error(`Image for uniform ${e} must be fully loaded`);let r=this.textures.get(e);r&&this.gl.deleteTexture(r);let i=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t);let a=this.gl.getError();if(a!==this.gl.NO_ERROR||i===null){console.error("WebGL error when uploading texture:",a);return}this.textures.set(e,i);let s=this.uniformLocations[e];if(s){let u=this.textures.size-1;this.gl.useProgram(this.program),this.gl.activeTexture(this.gl.TEXTURE0+u),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.uniform1i(s,u);let n=`${e}_aspect_ratio`,l=this.uniformLocations[n];if(l){let m=t.naturalWidth/t.naturalHeight;this.gl.uniform1f(l,m)}}};setUniformValues=e=>{this.gl.useProgram(this.program),Object.entries(e).forEach(([t,r])=>{let i=this.uniformLocations[t];if(!i){console.warn(`Uniform location for ${t} not found`);return}if(r instanceof HTMLImageElement)this.setTextureUniform(t,r);else if(Array.isArray(r))switch(r.length){case 2:this.gl.uniform2fv(i,r);break;case 3:this.gl.uniform3fv(i,r);break;case 4:this.gl.uniform4fv(i,r);break;default:r.length===9?this.gl.uniformMatrix3fv(i,!1,r):r.length===16?this.gl.uniformMatrix4fv(i,!1,r):console.warn(`Unsupported uniform array length: ${r.length}`)}else typeof r=="number"?this.gl.uniform1f(i,r):typeof r=="boolean"?this.gl.uniform1i(i,r?1:0):console.warn(`Unsupported uniform type for ${t}: ${typeof r}`)})};getCurrentFrameTime=()=>this.totalFrameTime;setFrame=e=>{this.totalFrameTime=e,this.lastRenderTime=performance.now(),this.render(performance.now())};setSpeed=(e=1)=>{this.speed=e,this.rafId===null&&e!==0&&(this.lastRenderTime=performance.now(),this.rafId=requestAnimationFrame(this.render)),this.rafId!==null&&e===0&&(cancelAnimationFrame(this.rafId),this.rafId=null)};setUniforms=e=>{this.providedUniforms={...this.providedUniforms,...e},this.setUniformValues(e),this.render(performance.now())};dispose=()=>{this.hasBeenDisposed=!0,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.gl&&this.program&&(this.textures.forEach(e=>{this.gl.deleteTexture(e)}),this.textures.clear(),this.gl.deleteProgram(this.program),this.program=null,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.getError()),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.uniformLocations={},this.mountToDiv.paperShaderMount=void 0}},S=`#version 300 es
2
+
3
+ // packages/shaders/src/shader-mount.ts
4
+ function isPaperShaderDivWrapper(div) {
5
+ return "paperShaderMount" in div;
6
+ }
7
+ var ShaderMount = class {
8
+ mountToDiv;
9
+ canvas;
10
+ gl;
11
+ program = null;
12
+ uniformLocations = {};
13
+ /** The fragment shader that we are using */
14
+ fragmentShader;
15
+ /** Stores the RAF for the render loop */
16
+ rafId = null;
17
+ /** Time of the last rendered frame */
18
+ lastRenderTime = 0;
19
+ /** Total time that we have played any animation, passed as a uniform to the shader for time-based VFX */
20
+ totalFrameTime = 0;
21
+ /** The current speed that we progress through animation time (multiplies by delta time every update). Allows negatives to play in reverse. If set to 0, rAF will stop entirely so static shaders have no recurring performance costs */
22
+ speed = 0;
23
+ /** Uniforms that are provided by the user for the specific shader being mounted (not including uniforms that this Mount adds, like time and resolution) */
24
+ providedUniforms;
25
+ /** Just a sanity check to make sure frames don't run after we're disposed */
26
+ hasBeenDisposed = false;
27
+ /** If the resolution of the canvas has changed since the last render */
28
+ resolutionChanged = true;
29
+ /** Store textures that are provided by the user */
30
+ textures = /* @__PURE__ */ new Map();
31
+ /** The maximum resolution (on the larger axis) that we render for the shader, to protect against insane resolutions and bad performance. Actual CSS size of the canvas can be larger, it will just lose quality after this */
32
+ maxResolution = 0;
33
+ // set by constructor
34
+ constructor(mountToDiv, fragmentShader, uniforms = {}, webGlContextAttributes, speed = 0, frame = 0, maxResolution = 1920) {
35
+ const canvas = document.createElement("canvas");
36
+ mountToDiv.style.contain = "strict";
37
+ mountToDiv.style.position = "relative";
38
+ canvas.style.position = "absolute";
39
+ canvas.style.inset = "0";
40
+ canvas.style.zIndex = "-1";
41
+ canvas.style.width = "100%";
42
+ canvas.style.height = "100%";
43
+ this.canvas = canvas;
44
+ this.mountToDiv = mountToDiv;
45
+ mountToDiv.appendChild(canvas);
46
+ this.fragmentShader = fragmentShader;
47
+ this.providedUniforms = uniforms;
48
+ this.totalFrameTime = frame;
49
+ this.maxResolution = maxResolution;
50
+ const gl = canvas.getContext("webgl2", webGlContextAttributes);
51
+ if (!gl) {
52
+ throw new Error("WebGL not supported");
53
+ }
54
+ this.gl = gl;
55
+ this.initProgram();
56
+ this.setupPositionAttribute();
57
+ this.setupUniforms();
58
+ this.setUniformValues(this.providedUniforms);
59
+ this.setupResizeObserver();
60
+ this.setSpeed(speed);
61
+ this.canvas.setAttribute("data-paper-shaders", "true");
62
+ this.mountToDiv.paperShaderMount = this;
63
+ }
64
+ initProgram = () => {
65
+ const program = createProgram(this.gl, vertexShaderSource, this.fragmentShader);
66
+ if (!program) return;
67
+ this.program = program;
68
+ };
69
+ setupPositionAttribute = () => {
70
+ const positionAttributeLocation = this.gl.getAttribLocation(this.program, "a_position");
71
+ const positionBuffer = this.gl.createBuffer();
72
+ this.gl.bindBuffer(this.gl.ARRAY_BUFFER, positionBuffer);
73
+ const positions = [-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1];
74
+ this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(positions), this.gl.STATIC_DRAW);
75
+ this.gl.enableVertexAttribArray(positionAttributeLocation);
76
+ this.gl.vertexAttribPointer(positionAttributeLocation, 2, this.gl.FLOAT, false, 0, 0);
77
+ };
78
+ setupUniforms = () => {
79
+ const uniformLocations = {
80
+ u_time: this.gl.getUniformLocation(this.program, "u_time"),
81
+ u_pixelRatio: this.gl.getUniformLocation(this.program, "u_pixelRatio"),
82
+ u_resolution: this.gl.getUniformLocation(this.program, "u_resolution")
83
+ };
84
+ Object.entries(this.providedUniforms).forEach(([key, value]) => {
85
+ uniformLocations[key] = this.gl.getUniformLocation(this.program, key);
86
+ if (value instanceof HTMLImageElement) {
87
+ const aspectRatioUniformName = `${key}_aspect_ratio`;
88
+ uniformLocations[aspectRatioUniformName] = this.gl.getUniformLocation(this.program, aspectRatioUniformName);
89
+ }
90
+ });
91
+ this.uniformLocations = uniformLocations;
92
+ };
93
+ resizeObserver = null;
94
+ setupResizeObserver = () => {
95
+ this.resizeObserver = new ResizeObserver(() => this.handleResize());
96
+ this.resizeObserver.observe(this.mountToDiv);
97
+ this.handleResize();
98
+ };
99
+ /** The scale that we should render at (prevents the virtual resolution from going beyond our maxium and then multiplies by pixelRatio (at least 2X rendering always) */
100
+ renderScale = 1;
101
+ /** Resize handler for when the container div changes size and we want to resize our canvas to match */
102
+ handleResize = () => {
103
+ const clientWidth = this.mountToDiv.clientWidth;
104
+ const clientHeight = this.mountToDiv.clientHeight;
105
+ const maxResolution = this.maxResolution;
106
+ const pixelRatio = Math.max(2, window.devicePixelRatio);
107
+ this.renderScale = Math.min(1, maxResolution / Math.max(clientWidth, clientHeight)) * pixelRatio;
108
+ let newWidth = clientWidth * this.renderScale;
109
+ let newHeight = clientHeight * this.renderScale;
110
+ if (this.canvas.width !== newWidth || this.canvas.height !== newHeight) {
111
+ this.canvas.width = newWidth;
112
+ this.canvas.height = newHeight;
113
+ this.resolutionChanged = true;
114
+ this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
115
+ this.render(performance.now());
116
+ }
117
+ };
118
+ render = (currentTime) => {
119
+ if (this.hasBeenDisposed) return;
120
+ if (this.program === null) {
121
+ console.warn("Tried to render before program or gl was initialized");
122
+ return;
123
+ }
124
+ const dt = currentTime - this.lastRenderTime;
125
+ this.lastRenderTime = currentTime;
126
+ if (this.speed !== 0) {
127
+ this.totalFrameTime += dt * this.speed;
128
+ }
129
+ this.gl.clear(this.gl.COLOR_BUFFER_BIT);
130
+ this.gl.useProgram(this.program);
131
+ this.gl.uniform1f(this.uniformLocations.u_time, this.totalFrameTime * 1e-3);
132
+ if (this.resolutionChanged) {
133
+ this.gl.uniform2f(this.uniformLocations.u_resolution, this.gl.canvas.width, this.gl.canvas.height);
134
+ this.gl.uniform1f(this.uniformLocations.u_pixelRatio, this.renderScale);
135
+ this.resolutionChanged = false;
136
+ }
137
+ this.gl.drawArrays(this.gl.TRIANGLES, 0, 6);
138
+ if (this.speed !== 0) {
139
+ this.requestRender();
140
+ } else {
141
+ this.rafId = null;
142
+ }
143
+ };
144
+ requestRender = () => {
145
+ if (this.rafId !== null) {
146
+ cancelAnimationFrame(this.rafId);
147
+ }
148
+ this.rafId = requestAnimationFrame(this.render);
149
+ };
150
+ /** Creates a texture from an image and sets it into a uniform value */
151
+ setTextureUniform = (uniformName, image) => {
152
+ if (!image.complete || image.naturalWidth === 0) {
153
+ throw new Error(`Image for uniform ${uniformName} must be fully loaded`);
154
+ }
155
+ const existingTexture = this.textures.get(uniformName);
156
+ if (existingTexture) {
157
+ this.gl.deleteTexture(existingTexture);
158
+ }
159
+ const texture = this.gl.createTexture();
160
+ this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
161
+ this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
162
+ this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
163
+ this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
164
+ this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
165
+ this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image);
166
+ const error = this.gl.getError();
167
+ if (error !== this.gl.NO_ERROR || texture === null) {
168
+ console.error("WebGL error when uploading texture:", error);
169
+ return;
170
+ }
171
+ this.textures.set(uniformName, texture);
172
+ const location = this.uniformLocations[uniformName];
173
+ if (location) {
174
+ const textureUnit = this.textures.size - 1;
175
+ this.gl.useProgram(this.program);
176
+ this.gl.activeTexture(this.gl.TEXTURE0 + textureUnit);
177
+ this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
178
+ this.gl.uniform1i(location, textureUnit);
179
+ const aspectRatioUniformName = `${uniformName}_aspect_ratio`;
180
+ const aspectRatioLocation = this.uniformLocations[aspectRatioUniformName];
181
+ if (aspectRatioLocation) {
182
+ const aspectRatio = image.naturalWidth / image.naturalHeight;
183
+ this.gl.uniform1f(aspectRatioLocation, aspectRatio);
184
+ }
185
+ }
186
+ };
187
+ /** Sets the provided uniform values into the WebGL program, can be a partial list of uniforms that have changed */
188
+ setUniformValues = (updatedUniforms) => {
189
+ this.gl.useProgram(this.program);
190
+ Object.entries(updatedUniforms).forEach(([key, value]) => {
191
+ const location = this.uniformLocations[key];
192
+ if (!location) {
193
+ console.warn(`Uniform location for ${key} not found`);
194
+ return;
195
+ }
196
+ if (value instanceof HTMLImageElement) {
197
+ this.setTextureUniform(key, value);
198
+ } else if (Array.isArray(value)) {
199
+ switch (value.length) {
200
+ case 2:
201
+ this.gl.uniform2fv(location, value);
202
+ break;
203
+ case 3:
204
+ this.gl.uniform3fv(location, value);
205
+ break;
206
+ case 4:
207
+ this.gl.uniform4fv(location, value);
208
+ break;
209
+ default:
210
+ if (value.length === 9) {
211
+ this.gl.uniformMatrix3fv(location, false, value);
212
+ } else if (value.length === 16) {
213
+ this.gl.uniformMatrix4fv(location, false, value);
214
+ } else {
215
+ console.warn(`Unsupported uniform array length: ${value.length}`);
216
+ }
217
+ }
218
+ } else if (typeof value === "number") {
219
+ this.gl.uniform1f(location, value);
220
+ } else if (typeof value === "boolean") {
221
+ this.gl.uniform1i(location, value ? 1 : 0);
222
+ } else {
223
+ console.warn(`Unsupported uniform type for ${key}: ${typeof value}`);
224
+ }
225
+ });
226
+ };
227
+ /** Gets the current total animation time from 0ms */
228
+ getCurrentFrameTime = () => {
229
+ return this.totalFrameTime;
230
+ };
231
+ /** Set a frame to get a deterministic result, frames are literally just milliseconds from zero since the animation started */
232
+ setFrame = (newFrame) => {
233
+ this.totalFrameTime = newFrame;
234
+ this.lastRenderTime = performance.now();
235
+ this.render(performance.now());
236
+ };
237
+ /** Set an animation speed (or 0 to stop animation) */
238
+ setSpeed = (newSpeed = 1) => {
239
+ this.speed = newSpeed;
240
+ if (this.rafId === null && newSpeed !== 0) {
241
+ this.lastRenderTime = performance.now();
242
+ this.rafId = requestAnimationFrame(this.render);
243
+ }
244
+ if (this.rafId !== null && newSpeed === 0) {
245
+ cancelAnimationFrame(this.rafId);
246
+ this.rafId = null;
247
+ }
248
+ };
249
+ /** Update the uniforms that are provided by the outside shader, can be a partial set with only the uniforms that have changed */
250
+ setUniforms = (newUniforms) => {
251
+ this.providedUniforms = { ...this.providedUniforms, ...newUniforms };
252
+ this.setUniformValues(newUniforms);
253
+ this.render(performance.now());
254
+ };
255
+ /** Dispose of the shader mount, cleaning up all of the WebGL resources */
256
+ dispose = () => {
257
+ this.hasBeenDisposed = true;
258
+ if (this.rafId !== null) {
259
+ cancelAnimationFrame(this.rafId);
260
+ this.rafId = null;
261
+ }
262
+ if (this.gl && this.program) {
263
+ this.textures.forEach((texture) => {
264
+ this.gl.deleteTexture(texture);
265
+ });
266
+ this.textures.clear();
267
+ this.gl.deleteProgram(this.program);
268
+ this.program = null;
269
+ this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);
270
+ this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null);
271
+ this.gl.bindRenderbuffer(this.gl.RENDERBUFFER, null);
272
+ this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, null);
273
+ this.gl.getError();
274
+ }
275
+ if (this.resizeObserver) {
276
+ this.resizeObserver.disconnect();
277
+ this.resizeObserver = null;
278
+ }
279
+ this.uniformLocations = {};
280
+ this.mountToDiv.paperShaderMount = void 0;
281
+ };
282
+ };
283
+ var vertexShaderSource = `#version 300 es
3
284
  layout(location = 0) in vec4 a_position;
4
285
 
5
286
  void main() {
6
287
  gl_Position = a_position;
7
288
  }
8
- `;function b(o,e,t){let r=o.createShader(e);return r?(o.shaderSource(r,t),o.compileShader(r),o.getShaderParameter(r,o.COMPILE_STATUS)?r:(console.error("An error occurred compiling the shaders: "+o.getShaderInfoLog(r)),o.deleteShader(r),null)):null}function R(o,e,t){let r=b(o,o.VERTEX_SHADER,e),i=b(o,o.FRAGMENT_SHADER,t);if(!r||!i)return null;let a=o.createProgram();return a?(o.attachShader(a,r),o.attachShader(a,i),o.linkProgram(a),o.getProgramParameter(a,o.LINK_STATUS)?(o.detachShader(a,r),o.detachShader(a,i),o.deleteShader(r),o.deleteShader(i),a):(console.error("Unable to initialize the shader program: "+o.getProgramInfoLog(a)),o.deleteProgram(a),o.deleteShader(r),o.deleteShader(i),null)):null}var w=`#version 300 es
289
+ `;
290
+ function createShader(gl, type, source) {
291
+ const shader = gl.createShader(type);
292
+ if (!shader) return null;
293
+ gl.shaderSource(shader, source);
294
+ gl.compileShader(shader);
295
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
296
+ console.error("An error occurred compiling the shaders: " + gl.getShaderInfoLog(shader));
297
+ gl.deleteShader(shader);
298
+ return null;
299
+ }
300
+ return shader;
301
+ }
302
+ function createProgram(gl, vertexShaderSource2, fragmentShaderSource) {
303
+ const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource2);
304
+ const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);
305
+ if (!vertexShader || !fragmentShader) return null;
306
+ const program = gl.createProgram();
307
+ if (!program) return null;
308
+ gl.attachShader(program, vertexShader);
309
+ gl.attachShader(program, fragmentShader);
310
+ gl.linkProgram(program);
311
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
312
+ console.error("Unable to initialize the shader program: " + gl.getProgramInfoLog(program));
313
+ gl.deleteProgram(program);
314
+ gl.deleteShader(vertexShader);
315
+ gl.deleteShader(fragmentShader);
316
+ return null;
317
+ }
318
+ gl.detachShader(program, vertexShader);
319
+ gl.detachShader(program, fragmentShader);
320
+ gl.deleteShader(vertexShader);
321
+ gl.deleteShader(fragmentShader);
322
+ return program;
323
+ }
324
+
325
+ // packages/shaders/src/shaders/mesh-gradient.ts
326
+ var meshGradientFragmentShader = `#version 300 es
9
327
  precision highp float;
10
328
 
11
329
  uniform float u_pixelRatio;
@@ -83,7 +401,10 @@ void main() {
83
401
 
84
402
  fragColor = vec4(color, opacity);
85
403
  }
86
- `;var z=`#version 300 es
404
+ `;
405
+
406
+ // packages/shaders/src/shaders/smoke-ring.ts
407
+ var smokeRingFragmentShader = `#version 300 es
87
408
  precision highp float;
88
409
 
89
410
  uniform float u_pixelRatio;
@@ -186,7 +507,10 @@ void main() {
186
507
 
187
508
  fragColor = vec4(color, opacity);
188
509
  }
189
- `;var C=`#version 300 es
510
+ `;
511
+
512
+ // packages/shaders/src/shaders/neuro-noise.ts
513
+ var neuroNoiseFragmentShader = `#version 300 es
190
514
  precision highp float;
191
515
 
192
516
  uniform float u_time;
@@ -243,7 +567,10 @@ void main() {
243
567
 
244
568
  fragColor = vec4(color, opacity);
245
569
  }
246
- `;var T=`#version 300 es
570
+ `;
571
+
572
+ // packages/shaders/src/shaders/dot-orbit.ts
573
+ var dotOrbitFragmentShader = `#version 300 es
247
574
  precision highp float;
248
575
 
249
576
  uniform float u_time;
@@ -330,7 +657,16 @@ void main() {
330
657
 
331
658
  fragColor = vec4(color * opacity, opacity);
332
659
  }
333
- `;var I={Circle:0,Diamond:1,Square:2,Triangle:3},P=`#version 300 es
660
+ `;
661
+
662
+ // packages/shaders/src/shaders/dot-grid.ts
663
+ var DotGridShapes = {
664
+ Circle: 0,
665
+ Diamond: 1,
666
+ Square: 2,
667
+ Triangle: 3
668
+ };
669
+ var dotGridFragmentShader = `#version 300 es
334
670
  precision highp float;
335
671
 
336
672
  uniform vec2 u_resolution;
@@ -442,7 +778,10 @@ void main() {
442
778
 
443
779
  fragColor = vec4(color, opacity);
444
780
  }
445
- `;var F=`#version 300 es
781
+ `;
782
+
783
+ // packages/shaders/src/shaders/stepped-simplex-noise.ts
784
+ var steppedSimplexNoiseFragmentShader = `#version 300 es
446
785
  precision highp float;
447
786
 
448
787
  uniform float u_time;
@@ -529,7 +868,10 @@ void main() {
529
868
  }
530
869
  fragColor = vec4(color, opacity);
531
870
  }
532
- `;var k=`#version 300 es
871
+ `;
872
+
873
+ // packages/shaders/src/shaders/metaballs.ts
874
+ var metaballsFragmentShader = `#version 300 es
533
875
  precision highp float;
534
876
 
535
877
  uniform float u_time;
@@ -625,7 +967,10 @@ void main() {
625
967
 
626
968
  fragColor = vec4(color, opacity);
627
969
  }
628
- `;var U=`#version 300 es
970
+ `;
971
+
972
+ // packages/shaders/src/shaders/perlin-noise.ts
973
+ var perlinNoiseFragmentShader = `#version 300 es
629
974
  precision highp float;
630
975
 
631
976
  uniform float u_time;
@@ -808,7 +1153,10 @@ void main() {
808
1153
 
809
1154
  fragColor = vec4(color, opacity);
810
1155
  }
811
- `;var W=`#version 300 es
1156
+ `;
1157
+
1158
+ // packages/shaders/src/shaders/voronoi.ts
1159
+ var voronoiFragmentShader = `#version 300 es
812
1160
  precision highp float;
813
1161
 
814
1162
  uniform float u_time;
@@ -919,7 +1267,10 @@ void main() {
919
1267
 
920
1268
  fragColor = vec4(color, opacity);
921
1269
  }
922
- `;var E=`#version 300 es
1270
+ `;
1271
+
1272
+ // packages/shaders/src/shaders/waves.ts
1273
+ var wavesFragmentShader = `#version 300 es
923
1274
  precision highp float;
924
1275
 
925
1276
  uniform float u_pixelRatio;
@@ -977,7 +1328,15 @@ void main() {
977
1328
 
978
1329
  fragColor = vec4(color, opacity);
979
1330
  }
980
- `;var D={Checks:0,Stripes:1,Edge:2},O=`#version 300 es
1331
+ `;
1332
+
1333
+ // packages/shaders/src/shaders/warp.ts
1334
+ var PatternShapes = {
1335
+ Checks: 0,
1336
+ Stripes: 1,
1337
+ Edge: 2
1338
+ };
1339
+ var warpFragmentShader = `#version 300 es
981
1340
  precision highp float;
982
1341
 
983
1342
  uniform float u_time;
@@ -1098,7 +1457,10 @@ void main() {
1098
1457
 
1099
1458
  fragColor = vec4(color_mix.rgb, color_mix.a);
1100
1459
  }
1101
- `;var L=`#version 300 es
1460
+ `;
1461
+
1462
+ // packages/shaders/src/shaders/god-rays.ts
1463
+ var godRaysFragmentShader = `#version 300 es
1102
1464
  precision highp float;
1103
1465
 
1104
1466
  uniform float u_time;
@@ -1211,7 +1573,10 @@ void main() {
1211
1573
 
1212
1574
  fragColor = vec4(color, opacity);
1213
1575
  }
1214
- `;var A=`#version 300 es
1576
+ `;
1577
+
1578
+ // packages/shaders/src/shaders/spiral.ts
1579
+ var spiralFragmentShader = `#version 300 es
1215
1580
  precision highp float;
1216
1581
 
1217
1582
  uniform float u_scale;
@@ -1312,5 +1677,109 @@ void main() {
1312
1677
 
1313
1678
  fragColor = vec4(color, opacity);
1314
1679
  }
1315
- `;function d(o,e=[0,0,0,1]){if(Array.isArray(o))return o.length===4?o:o.length===3?[...o,1]:d(e);if(typeof o!="string")return d(e);let t,r,i,a=1;if(o.startsWith("#"))[t,r,i,a]=M(o);else if(o.startsWith("rgb"))[t,r,i,a]=G(o);else if(o.startsWith("hsl"))[t,r,i,a]=q(B(o));else return console.error("Unsupported color format",o),d(e);return[p(t,0,1),p(r,0,1),p(i,0,1),p(a,0,1)]}function M(o){o=o.replace(/^#/,""),o.length===3&&(o=o.split("").map(a=>a+a).join("")),o.length===6&&(o=o+"ff");let e=parseInt(o.slice(0,2),16)/255,t=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,i=parseInt(o.slice(6,8),16)/255;return[e,t,r,i]}function G(o){let e=o.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);return e?[parseInt(e[1]??"0")/255,parseInt(e[2]??"0")/255,parseInt(e[3]??"0")/255,e[4]===void 0?1:parseFloat(e[4])]:[0,0,0,1]}function B(o){let e=o.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);return e?[parseInt(e[1]??"0"),parseInt(e[2]??"0"),parseInt(e[3]??"0"),e[4]===void 0?1:parseFloat(e[4])]:[0,0,0,1]}function q(o){let[e,t,r,i]=o,a=e/360,s=t/100,u=r/100,n,l,m;if(t===0)n=l=m=u;else{let h=(f,g,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<.16666666666666666?f+(g-f)*6*c:c<.5?g:c<.6666666666666666?f+(g-f)*(.6666666666666666-c)*6:f),_=u<.5?u*(1+s):u+s-u*s,v=2*u-_;n=h(v,_,a+1/3),l=h(v,_,a),m=h(v,_,a-1/3)}return[n,l,m,i]}var p=(o,e,t)=>Math.min(Math.max(o,e),t);export{I as DotGridShapes,D as PatternShapes,x as ShaderMount,P as dotGridFragmentShader,T as dotOrbitFragmentShader,d as getShaderColorFromString,L as godRaysFragmentShader,y as isPaperShaderDivWrapper,w as meshGradientFragmentShader,k as metaballsFragmentShader,C as neuroNoiseFragmentShader,U as perlinNoiseFragmentShader,z as smokeRingFragmentShader,A as spiralFragmentShader,F as steppedSimplexNoiseFragmentShader,W as voronoiFragmentShader,O as warpFragmentShader,E as wavesFragmentShader};
1680
+ `;
1681
+
1682
+ // packages/shaders/src/get-shader-color-from-string.ts
1683
+ function getShaderColorFromString(colorString, fallback = [0, 0, 0, 1]) {
1684
+ if (Array.isArray(colorString)) {
1685
+ if (colorString.length === 4) return colorString;
1686
+ if (colorString.length === 3) return [...colorString, 1];
1687
+ return getShaderColorFromString(fallback);
1688
+ }
1689
+ if (typeof colorString !== "string") {
1690
+ return getShaderColorFromString(fallback);
1691
+ }
1692
+ let r, g, b, a = 1;
1693
+ if (colorString.startsWith("#")) {
1694
+ [r, g, b, a] = hexToRgba(colorString);
1695
+ } else if (colorString.startsWith("rgb")) {
1696
+ [r, g, b, a] = parseRgba(colorString);
1697
+ } else if (colorString.startsWith("hsl")) {
1698
+ [r, g, b, a] = hslaToRgba(parseHsla(colorString));
1699
+ } else {
1700
+ console.error("Unsupported color format", colorString);
1701
+ return getShaderColorFromString(fallback);
1702
+ }
1703
+ return [clamp(r, 0, 1), clamp(g, 0, 1), clamp(b, 0, 1), clamp(a, 0, 1)];
1704
+ }
1705
+ function hexToRgba(hex) {
1706
+ hex = hex.replace(/^#/, "");
1707
+ if (hex.length === 3) {
1708
+ hex = hex.split("").map((char) => char + char).join("");
1709
+ }
1710
+ if (hex.length === 6) {
1711
+ hex = hex + "ff";
1712
+ }
1713
+ const r = parseInt(hex.slice(0, 2), 16) / 255;
1714
+ const g = parseInt(hex.slice(2, 4), 16) / 255;
1715
+ const b = parseInt(hex.slice(4, 6), 16) / 255;
1716
+ const a = parseInt(hex.slice(6, 8), 16) / 255;
1717
+ return [r, g, b, a];
1718
+ }
1719
+ function parseRgba(rgba) {
1720
+ const match = rgba.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);
1721
+ if (!match) return [0, 0, 0, 1];
1722
+ return [
1723
+ parseInt(match[1] ?? "0") / 255,
1724
+ parseInt(match[2] ?? "0") / 255,
1725
+ parseInt(match[3] ?? "0") / 255,
1726
+ match[4] === void 0 ? 1 : parseFloat(match[4])
1727
+ ];
1728
+ }
1729
+ function parseHsla(hsla) {
1730
+ const match = hsla.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);
1731
+ if (!match) return [0, 0, 0, 1];
1732
+ return [
1733
+ parseInt(match[1] ?? "0"),
1734
+ parseInt(match[2] ?? "0"),
1735
+ parseInt(match[3] ?? "0"),
1736
+ match[4] === void 0 ? 1 : parseFloat(match[4])
1737
+ ];
1738
+ }
1739
+ function hslaToRgba(hsla) {
1740
+ const [h, s, l, a] = hsla;
1741
+ const hDecimal = h / 360;
1742
+ const sDecimal = s / 100;
1743
+ const lDecimal = l / 100;
1744
+ let r, g, b;
1745
+ if (s === 0) {
1746
+ r = g = b = lDecimal;
1747
+ } else {
1748
+ const hue2rgb = (p2, q2, t) => {
1749
+ if (t < 0) t += 1;
1750
+ if (t > 1) t -= 1;
1751
+ if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
1752
+ if (t < 1 / 2) return q2;
1753
+ if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
1754
+ return p2;
1755
+ };
1756
+ const q = lDecimal < 0.5 ? lDecimal * (1 + sDecimal) : lDecimal + sDecimal - lDecimal * sDecimal;
1757
+ const p = 2 * lDecimal - q;
1758
+ r = hue2rgb(p, q, hDecimal + 1 / 3);
1759
+ g = hue2rgb(p, q, hDecimal);
1760
+ b = hue2rgb(p, q, hDecimal - 1 / 3);
1761
+ }
1762
+ return [r, g, b, a];
1763
+ }
1764
+ var clamp = (n, min, max) => Math.min(Math.max(n, min), max);
1765
+ export {
1766
+ DotGridShapes,
1767
+ PatternShapes,
1768
+ ShaderMount,
1769
+ dotGridFragmentShader,
1770
+ dotOrbitFragmentShader,
1771
+ getShaderColorFromString,
1772
+ godRaysFragmentShader,
1773
+ isPaperShaderDivWrapper,
1774
+ meshGradientFragmentShader,
1775
+ metaballsFragmentShader,
1776
+ neuroNoiseFragmentShader,
1777
+ perlinNoiseFragmentShader,
1778
+ smokeRingFragmentShader,
1779
+ spiralFragmentShader,
1780
+ steppedSimplexNoiseFragmentShader,
1781
+ voronoiFragmentShader,
1782
+ warpFragmentShader,
1783
+ wavesFragmentShader
1784
+ };
1316
1785
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/shader-mount.ts", "../src/shaders/mesh-gradient.ts", "../src/shaders/smoke-ring.ts", "../src/shaders/neuro-noise.ts", "../src/shaders/dot-orbit.ts", "../src/shaders/dot-grid.ts", "../src/shaders/stepped-simplex-noise.ts", "../src/shaders/metaballs.ts", "../src/shaders/perlin-noise.ts", "../src/shaders/voronoi.ts", "../src/shaders/waves.ts", "../src/shaders/warp.ts", "../src/shaders/god-rays.ts", "../src/shaders/spiral.ts", "../src/get-shader-color-from-string.ts"],
4
4
  "sourcesContent": ["/** Uniform types that we support to be auto-mapped into the fragment shader */\nexport type ShaderMountUniforms = Record<string, number | number[] | HTMLImageElement>;\n\n/** A canvas element that has a ShaderMount available on it */\nexport interface PaperShaderDivWrapperElement extends HTMLDivElement {\n paperShaderMount: ShaderMount | undefined;\n}\n/** Check if a canvas element is a ShaderCanvas */\nexport function isPaperShaderDivWrapper(div: HTMLDivElement): div is PaperShaderDivWrapperElement {\n return 'paperShaderMount' in div;\n}\n\nexport class ShaderMount {\n public mountToDiv: PaperShaderDivWrapperElement;\n public canvas: HTMLCanvasElement;\n private gl: WebGLRenderingContext;\n private program: WebGLProgram | null = null;\n private uniformLocations: Record<string, WebGLUniformLocation | null> = {};\n /** The fragment shader that we are using */\n private fragmentShader: string;\n /** Stores the RAF for the render loop */\n private rafId: number | null = null;\n /** Time of the last rendered frame */\n private lastRenderTime = 0;\n /** Total time that we have played any animation, passed as a uniform to the shader for time-based VFX */\n private totalFrameTime = 0;\n /** The current speed that we progress through animation time (multiplies by delta time every update). Allows negatives to play in reverse. If set to 0, rAF will stop entirely so static shaders have no recurring performance costs */\n private speed = 0;\n /** Uniforms that are provided by the user for the specific shader being mounted (not including uniforms that this Mount adds, like time and resolution) */\n private providedUniforms: ShaderMountUniforms;\n /** Just a sanity check to make sure frames don't run after we're disposed */\n private hasBeenDisposed = false;\n /** If the resolution of the canvas has changed since the last render */\n private resolutionChanged = true;\n /** Store textures that are provided by the user */\n private textures: Map<string, WebGLTexture> = new Map();\n /** The maximum resolution (on the larger axis) that we render for the shader, to protect against insane resolutions and bad performance. Actual CSS size of the canvas can be larger, it will just lose quality after this */\n private maxResolution = 0; // set by constructor\n\n constructor(\n /** The div you'd like to mount the shader to. The shader will match its size. */\n mountToDiv: HTMLDivElement,\n fragmentShader: string,\n uniforms: ShaderMountUniforms = {},\n webGlContextAttributes?: WebGLContextAttributes,\n /** The speed of the animation, or 0 to stop it. Supports negative values to play in reverse. */\n speed = 0,\n /** Pass a frame to offset the starting u_time value and give deterministic results*/\n frame = 0,\n /** The maximum resolution (on the larger axis) that we render for the shader. Use virtual pixels, will be multiplied by display DPI to get the actual resolution. Actual CSS size of the canvas can be larger, it will just lose quality after this */\n maxResolution = 1920\n ) {\n // Create the canvas element and mount it into the provided div\n const canvas = document.createElement('canvas');\n mountToDiv.style.contain = 'strict';\n mountToDiv.style.position = 'relative';\n canvas.style.position = 'absolute';\n canvas.style.inset = '0';\n canvas.style.zIndex = '-1';\n canvas.style.width = '100%';\n canvas.style.height = '100%';\n this.canvas = canvas;\n this.mountToDiv = mountToDiv as PaperShaderDivWrapperElement;\n mountToDiv.appendChild(canvas);\n this.fragmentShader = fragmentShader;\n this.providedUniforms = uniforms;\n // Base our starting animation time on the provided frame value\n this.totalFrameTime = frame;\n this.maxResolution = maxResolution;\n\n const gl = canvas.getContext('webgl2', webGlContextAttributes);\n if (!gl) {\n throw new Error('WebGL not supported');\n }\n this.gl = gl;\n\n this.initProgram();\n this.setupPositionAttribute();\n // Grab the locations of the uniforms in the fragment shader\n this.setupUniforms();\n // Put the user provided values into the uniforms\n this.setUniformValues(this.providedUniforms);\n // Set up the resize observer to handle window resizing and set u_resolution\n this.setupResizeObserver();\n\n // Set the animation speed after everything is ready to go\n this.setSpeed(speed);\n\n // Mark canvas as paper shader mount\n this.canvas.setAttribute('data-paper-shaders', 'true');\n\n // Add the shaderMount instance to the div mount element to make it easily accessible\n this.mountToDiv.paperShaderMount = this;\n }\n\n private initProgram = () => {\n const program = createProgram(this.gl, vertexShaderSource, this.fragmentShader);\n if (!program) return;\n this.program = program;\n };\n\n private setupPositionAttribute = () => {\n const positionAttributeLocation = this.gl.getAttribLocation(this.program!, 'a_position');\n const positionBuffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, positionBuffer);\n const positions = [-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1];\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(positions), this.gl.STATIC_DRAW);\n this.gl.enableVertexAttribArray(positionAttributeLocation);\n this.gl.vertexAttribPointer(positionAttributeLocation, 2, this.gl.FLOAT, false, 0, 0);\n };\n\n private setupUniforms = () => {\n // Create a map to store all uniform locations\n const uniformLocations: Record<string, WebGLUniformLocation | null> = {\n u_time: this.gl.getUniformLocation(this.program!, 'u_time'),\n u_pixelRatio: this.gl.getUniformLocation(this.program!, 'u_pixelRatio'),\n u_resolution: this.gl.getUniformLocation(this.program!, 'u_resolution'),\n };\n\n // Add locations for all provided uniforms\n Object.entries(this.providedUniforms).forEach(([key, value]) => {\n uniformLocations[key] = this.gl.getUniformLocation(this.program!, key);\n\n // For texture uniforms, also look for the aspect ratio uniform\n if (value instanceof HTMLImageElement) {\n const aspectRatioUniformName = `${key}_aspect_ratio`;\n uniformLocations[aspectRatioUniformName] = this.gl.getUniformLocation(this.program!, aspectRatioUniformName);\n }\n });\n\n this.uniformLocations = uniformLocations;\n };\n\n private resizeObserver: ResizeObserver | null = null;\n private setupResizeObserver = () => {\n this.resizeObserver = new ResizeObserver(() => this.handleResize());\n this.resizeObserver.observe(this.mountToDiv);\n this.handleResize();\n };\n\n /** The scale that we should render at (prevents the virtual resolution from going beyond our maxium and then multiplies by pixelRatio (at least 2X rendering always) */\n private renderScale = 1;\n /** Resize handler for when the container div changes size and we want to resize our canvas to match */\n private handleResize = () => {\n const clientWidth = this.mountToDiv.clientWidth;\n const clientHeight = this.mountToDiv.clientHeight;\n const maxResolution = this.maxResolution;\n // Note we render at 2X even for 1x screens because it gives a much smoother looking result\n const pixelRatio = Math.max(2, window.devicePixelRatio);\n // Render scale prevents the virtual resolution from going beyond our maxium and then multiplies by pixelRatio (so at least 2X rendering)\n this.renderScale = Math.min(1, maxResolution / Math.max(clientWidth, clientHeight)) * pixelRatio;\n\n let newWidth = clientWidth * this.renderScale;\n let newHeight = clientHeight * this.renderScale;\n if (this.canvas.width !== newWidth || this.canvas.height !== newHeight) {\n this.canvas.width = newWidth;\n this.canvas.height = newHeight;\n\n this.resolutionChanged = true;\n this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n this.render(performance.now()); // this is necessary to avoid flashes while resizing (the next scheduled render will set uniforms)\n }\n };\n\n private render = (currentTime: number) => {\n if (this.hasBeenDisposed) return;\n\n if (this.program === null) {\n console.warn('Tried to render before program or gl was initialized');\n return;\n }\n\n // Calculate the delta time\n const dt = currentTime - this.lastRenderTime;\n this.lastRenderTime = currentTime;\n // Increase the total animation time by dt * animationSpeed\n if (this.speed !== 0) {\n this.totalFrameTime += dt * this.speed;\n }\n\n // Clear the canvas\n this.gl.clear(this.gl.COLOR_BUFFER_BIT);\n\n // Update uniforms\n this.gl.useProgram(this.program);\n\n // Update the time uniform\n this.gl.uniform1f(this.uniformLocations.u_time!, this.totalFrameTime * 0.001);\n\n // If the resolution has changed, we need to update the uniform\n if (this.resolutionChanged) {\n this.gl.uniform2f(this.uniformLocations.u_resolution!, this.gl.canvas.width, this.gl.canvas.height);\n this.gl.uniform1f(this.uniformLocations.u_pixelRatio!, this.renderScale);\n this.resolutionChanged = false;\n }\n\n this.gl.drawArrays(this.gl.TRIANGLES, 0, 6);\n\n // Loop if we're animating\n if (this.speed !== 0) {\n this.requestRender();\n } else {\n this.rafId = null;\n }\n };\n\n private requestRender = () => {\n if (this.rafId !== null) {\n cancelAnimationFrame(this.rafId);\n }\n this.rafId = requestAnimationFrame(this.render);\n };\n\n /** Creates a texture from an image and sets it into a uniform value */\n private setTextureUniform = (uniformName: string, image: HTMLImageElement): void => {\n if (!image.complete || image.naturalWidth === 0) {\n throw new Error(`Image for uniform ${uniformName} must be fully loaded`);\n }\n\n // Clean up existing texture if present\n const existingTexture = this.textures.get(uniformName);\n if (existingTexture) {\n this.gl.deleteTexture(existingTexture);\n }\n\n // Create and set up the new texture\n const texture = this.gl.createTexture();\n this.gl.bindTexture(this.gl.TEXTURE_2D, texture);\n\n // Set texture parameters\n this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);\n this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);\n this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);\n this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);\n\n // Upload image to texture\n this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image);\n const error = this.gl.getError();\n if (error !== this.gl.NO_ERROR || texture === null) {\n console.error('WebGL error when uploading texture:', error);\n return;\n }\n\n // Store the texture\n this.textures.set(uniformName, texture);\n\n // Set up texture unit and uniform\n const location = this.uniformLocations[uniformName];\n if (location) {\n // Use texture unit based on the order textures were added\n const textureUnit = this.textures.size - 1;\n this.gl.useProgram(this.program);\n this.gl.activeTexture(this.gl.TEXTURE0 + textureUnit);\n this.gl.bindTexture(this.gl.TEXTURE_2D, texture);\n this.gl.uniform1i(location, textureUnit);\n\n // Calculate and set the aspect ratio uniform\n const aspectRatioUniformName = `${uniformName}_aspect_ratio`;\n const aspectRatioLocation = this.uniformLocations[aspectRatioUniformName];\n if (aspectRatioLocation) {\n const aspectRatio = image.naturalWidth / image.naturalHeight;\n this.gl.uniform1f(aspectRatioLocation, aspectRatio);\n }\n }\n };\n\n /** Sets the provided uniform values into the WebGL program, can be a partial list of uniforms that have changed */\n private setUniformValues = (updatedUniforms: ShaderMountUniforms) => {\n this.gl.useProgram(this.program);\n Object.entries(updatedUniforms).forEach(([key, value]) => {\n const location = this.uniformLocations[key];\n if (!location) {\n console.warn(`Uniform location for ${key} not found`);\n return;\n }\n\n if (value instanceof HTMLImageElement) {\n // Texture case, requires a good amount of code so it gets its own function:\n this.setTextureUniform(key, value);\n } else if (Array.isArray(value)) {\n // Array case, supports 2, 3, 4, 9, 16 length arrays\n switch (value.length) {\n case 2:\n this.gl.uniform2fv(location, value);\n break;\n case 3:\n this.gl.uniform3fv(location, value);\n break;\n case 4:\n this.gl.uniform4fv(location, value);\n break;\n default:\n if (value.length === 9) {\n this.gl.uniformMatrix3fv(location, false, value);\n } else if (value.length === 16) {\n this.gl.uniformMatrix4fv(location, false, value);\n } else {\n console.warn(`Unsupported uniform array length: ${value.length}`);\n }\n }\n } else if (typeof value === 'number') {\n // Number case, supports floats and ints\n this.gl.uniform1f(location, value);\n } else if (typeof value === 'boolean') {\n // Boolean case, supports true and false\n this.gl.uniform1i(location, value ? 1 : 0);\n } else {\n console.warn(`Unsupported uniform type for ${key}: ${typeof value}`);\n }\n });\n };\n\n /** Gets the current total animation time from 0ms */\n public getCurrentFrameTime = (): number => {\n return this.totalFrameTime;\n };\n\n /** Set a frame to get a deterministic result, frames are literally just milliseconds from zero since the animation started */\n public setFrame = (newFrame: number): void => {\n this.totalFrameTime = newFrame;\n this.lastRenderTime = performance.now();\n this.render(performance.now());\n };\n\n /** Set an animation speed (or 0 to stop animation) */\n public setSpeed = (newSpeed: number = 1): void => {\n // Set the new animation speed\n this.speed = newSpeed;\n\n if (this.rafId === null && newSpeed !== 0) {\n // Moving from 0 to animating, kick off a new rAF loop\n this.lastRenderTime = performance.now();\n this.rafId = requestAnimationFrame(this.render);\n }\n\n if (this.rafId !== null && newSpeed === 0) {\n // Moving from animating to not animating, cancel the rAF loop\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n };\n\n /** Update the uniforms that are provided by the outside shader, can be a partial set with only the uniforms that have changed */\n public setUniforms = (newUniforms: ShaderMountUniforms): void => {\n this.providedUniforms = { ...this.providedUniforms, ...newUniforms };\n\n // If we need to allow users to add uniforms after the shader has been created, we can do that here\n // But right now we're expecting the uniform list to be predictable and static\n // this.setupUniforms();\n\n this.setUniformValues(newUniforms);\n this.render(performance.now());\n };\n\n /** Dispose of the shader mount, cleaning up all of the WebGL resources */\n public dispose = (): void => {\n // Immediately mark as disposed to prevent future renders from leaking in\n this.hasBeenDisposed = true;\n\n // Cancel the rAF loop\n if (this.rafId !== null) {\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n if (this.gl && this.program) {\n // Clean up all textures\n this.textures.forEach((texture) => {\n this.gl.deleteTexture(texture);\n });\n this.textures.clear();\n\n this.gl.deleteProgram(this.program);\n this.program = null;\n\n // Reset the WebGL context\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null);\n this.gl.bindRenderbuffer(this.gl.RENDERBUFFER, null);\n this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, null);\n\n // Clear any errors\n this.gl.getError();\n }\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n\n this.uniformLocations = {};\n\n // Remove the shader mount from the div wrapper element to avoid any GC issues\n this.mountToDiv.paperShaderMount = undefined;\n };\n}\n\n/** Vertex shader for the shader mount */\nconst vertexShaderSource = `#version 300 es\nlayout(location = 0) in vec4 a_position;\n\nvoid main() {\n gl_Position = a_position;\n}\n`;\n\nfunction createShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader | null {\n const shader = gl.createShader(type);\n if (!shader) return null;\n\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n console.error('An error occurred compiling the shaders: ' + gl.getShaderInfoLog(shader));\n gl.deleteShader(shader);\n return null;\n }\n\n return shader;\n}\n\nfunction createProgram(\n gl: WebGLRenderingContext,\n vertexShaderSource: string,\n fragmentShaderSource: string\n): WebGLProgram | null {\n const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource);\n const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);\n\n if (!vertexShader || !fragmentShader) return null;\n\n const program = gl.createProgram();\n if (!program) return null;\n\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n gl.linkProgram(program);\n\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n console.error('Unable to initialize the shader program: ' + gl.getProgramInfoLog(program));\n gl.deleteProgram(program);\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n return null;\n }\n\n // Clean up shaders after successful linking\n gl.detachShader(program, vertexShader);\n gl.detachShader(program, fragmentShader);\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n}\n", "export type MeshGradientUniforms = {\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_color3: [number, number, number, number];\n u_color4: [number, number, number, number];\n};\n\n/**\n * Mesh Gradient, based on https://www.shadertoy.com/view/wdyczG\n * Renders a mesh gradient with a rotating noise pattern\n * and several layers of fractal noise\n *\n * Uniforms include:\n * u_color1: The first color of the mesh gradient\n * u_color2: The second color of the mesh gradient\n * u_color3: The third color of the mesh gradient\n * u_color4: The fourth color of the mesh gradient\n */\n\nexport const meshGradientFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\nuniform float u_time;\n\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform vec4 u_color3;\nuniform vec4 u_color4;\n\nout vec4 fragColor;\n\n#define S(a,b,t) smoothstep(a,b,t)\n\nmat2 Rot(float a) {\n float s = sin(a);\n float c = cos(a);\n return mat2(c, -s, s, c);\n}\n\nvec2 hash(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.xx+p3.yz)*p3.zy);\n}\n\nfloat noise( in vec2 p ) {\n vec2 i = floor( p );\n vec2 f = fract( p );\n vec2 u = f*f*(3.0-2.0*f);\n\n float n = mix( mix( dot( -1.0+2.0*hash( i + vec2(0.0,0.0) ), f - vec2(0.0,0.0) ),\n dot( -1.0+2.0*hash( i + vec2(1.0,0.0) ), f - vec2(1.0,0.0) ), u.x),\n mix( dot( -1.0+2.0*hash( i + vec2(0.0,1.0) ), f - vec2(0.0,1.0) ),\n dot( -1.0+2.0*hash( i + vec2(1.0,1.0) ), f - vec2(1.0,1.0) ), u.x), u.y);\n return 0.5 + 0.5*n;\n}\n\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n float ratio = u_resolution.x / u_resolution.y;\n \n uv /= u_pixelRatio;\n \n vec2 tuv = uv;\n tuv -= .5;\n\n // rotate with Noise\n float degree = noise(vec2(u_time, tuv.x * tuv.y));\n\n tuv.y *= 1./ratio;\n tuv *= Rot(radians((degree-.5)*720.+180.));\n tuv.y *= ratio;\n\n\n // Wave warp with sin\n float frequency = 5.;\n float amplitude = 30.;\n float speed = u_time * 2.;\n tuv.x += sin(tuv.y*frequency+speed)/amplitude;\n tuv.y += sin(tuv.x*frequency*1.5+speed)/(amplitude*.5);\n\n\n float proportion_1 = S(-.3, .2, (tuv*Rot(radians(-5.))).x);\n vec3 layer1_color = mix(u_color1.rgb * u_color1.a, u_color2.rgb * u_color2.a, proportion_1);\n float layer1_opacity = mix(u_color1.a, u_color2.a, proportion_1);\n vec3 layer2_color = mix(u_color3.rgb * u_color3.a, u_color4.rgb * u_color4.a, proportion_1);\n float layer2_opacity = mix(u_color3.a, u_color4.a, proportion_1);\n\n float proportion_2 = S(.5, -.3, tuv.y);\n vec3 color = mix(layer1_color, layer2_color, proportion_2);\n float opacity = mix(layer1_opacity, layer2_opacity, proportion_2);\n \n fragColor = vec4(color, opacity);\n}\n`;\n", "export type SmokeRingUniforms = {\n u_scale: number;\n u_colorInner: [number, number, number, number];\n u_colorOuter: [number, number, number, number];\n u_noiseScale: number;\n u_thickness: number;\n};\n\n/**\n * Smoke Ring by Ksenia Kondrashova\n * Renders a fractional Brownian motion (fBm) noise over the\n * polar coordinates masked with ring shape\n *\n * Uniforms include:\n * u_scale - the scale applied to user space: with scale = 1 the ring fits the screen height\n * u_colorInner - the inner color of the ring gradient\n * u_colorOuter - the outer color of the ring gradient\n * u_noiseScale - the resolution of noise texture\n * u_thickness - the thickness of the ring\n */\n\nexport const smokeRingFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\nuniform float u_time;\n\nuniform float u_scale;\n\nuniform vec4 u_colorInner;\nuniform vec4 u_colorOuter;\nuniform float u_noiseScale;\nuniform float u_thickness;\n\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\nfloat random(in vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n}\nfloat noise(vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n\n // Smoothstep for interpolation\n vec2 u = f * f * (3.0 - 2.0 * f);\n\n // Do the interpolation as two nested mix operations\n // If you try to do this in one big operation, there's enough precision loss to be off by 1px at cell boundaries\n float x1 = mix(a, b, u.x);\n float x2 = mix(c, d, u.x);\n return mix(x1, x2, u.y);\n\n}\nfloat fbm(in vec2 n) {\n float total = 0.0, amplitude = .4;\n for (int i = 0; i < 12; i++) {\n total += noise(n) * amplitude;\n n += n;\n amplitude *= 0.6;\n }\n return total;\n}\n\nfloat get_ring_shape(vec2 uv, float innerRadius, float outerRadius) {\n float distance = length(uv);\n float line_width = outerRadius - innerRadius;\n float ringValue = smoothstep(innerRadius, innerRadius + .8 * line_width, distance);\n ringValue -= smoothstep(outerRadius, outerRadius + 1.2 * line_width, distance);\n return clamp(ringValue, 0., 1.);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n float ratio = u_resolution.x / u_resolution.y;\n\n uv -= .5;\n float scale = .5 * u_scale + 1e-4;\n uv *= (1. - step(1. - scale, 1.) / scale);\n uv *= 1.5;\n uv.x *= ratio;\n\n float t = u_time;\n\n float atg = atan(uv.y, uv.x);\n float angle = (atg + PI) / TWO_PI;\n\n vec2 polar_uv = vec2(atg, .1 * t - (.5 * length(uv)) + 1. / pow(length(uv), .5));\n polar_uv *= u_noiseScale;\n\n float noise_left = fbm(polar_uv + mod(.05 * t, 35.));\n polar_uv.x = mod(polar_uv.x, u_noiseScale * TWO_PI);\n float noise_right = fbm(polar_uv + mod(.05 * t, 35.));\n float noise = mix(noise_right, noise_left, smoothstep(-.2, .2, uv.x));\n\n float center_shape = 1. - pow(smoothstep(2., .0, length(uv)), 50.);\n\n float radius = .4 - .25 * u_thickness;\n float thickness = u_thickness;\n thickness = pow(thickness, 2.);\n\n float ring_shape = get_ring_shape(uv * (.5 + .6 * noise), radius - .2 * thickness, radius + .5 * thickness);\n\n float ring_shape_outer = 1. - pow(ring_shape, 7.);\n ring_shape_outer *= ring_shape;\n\n float ring_shape_inner = ring_shape - ring_shape_outer;\n ring_shape_inner *= ring_shape;\n\n float opacity = ring_shape_inner * u_colorInner.a;\n opacity += ring_shape_outer * u_colorOuter.a;\n\n vec3 color = u_colorOuter.rgb * ring_shape_outer * u_colorOuter.a;\n color += u_colorInner.rgb * ring_shape_inner * u_colorInner.a;\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type NeuroNoiseUniforms = {\n u_scale: number;\n u_colorFront: [number, number, number, number];\n u_colorBack: [number, number, number, number];\n u_brightness: number;\n};\n\n/**\n * Neuro Noise Pattern\n * The original artwork: https://codepen.io/ksenia-k/full/vYwgrWv by Ksenia Kondrashova\n * Renders a fractal-like structure made of several layers of since-arches\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_colorFront - the front color of pattern\n * u_colorBack - the back color of pattern\n * u_brightness - the power (brightness) of pattern lines\n */\n\nexport const neuroNoiseFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\nuniform vec4 u_colorFront;\nuniform vec4 u_colorBack;\nuniform float u_brightness;\n\nout vec4 fragColor;\n\nvec2 rotate(vec2 uv, float th) {\n return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv;\n}\n\nfloat neuro_shape(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 uv = gl_FragCoord.xy / u_resolution.xy;\n\n uv -= .5;\n float scale = .5 * u_scale + 1e-4;\n uv *= (.001 * (1. - step(1. - scale, 1.) / scale));\n uv *= u_resolution;\n uv /= u_pixelRatio;\n uv += .5;\n\n float t = u_time;\n\n float noise = neuro_shape(uv, t);\n\n noise = u_brightness * pow(noise, 3.);\n noise += pow(noise, 12.);\n noise = max(.0, noise - .5);\n\n vec3 color = mix(u_colorBack.rgb * u_colorBack.a, u_colorFront.rgb * u_colorFront.a, noise);\n float opacity = mix(u_colorBack.a, u_colorFront.a, noise);\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type DotOrbitUniforms = {\n u_scale: number;\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_color3: [number, number, number, number];\n u_color4: [number, number, number, number];\n u_dotSize: number;\n u_dotSizeRange: number;\n u_spreading: number;\n};\n\n/**\n * Dot Pattern with dot moving around their grid position\n * The artwork by Ksenia Kondrashova\n * Renders a dot pattern with dot placed in the center of each cell of animated Voronoi diagram\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_color1 - the first color\n * u_color2 - the second color\n * u_color3 - the third color\n * u_color4 - the fourth color\n * u_dotSize (0 .. 1) - the base dot radius (relative to cell size)\n * u_dotSizeRange (0 .. 1) - the dot radius to vary between the cells\n * u_spreading (0 .. 1) - the distance each dot can move around the regular grid\n */\n\nexport const dotOrbitFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform vec4 u_color3;\nuniform vec4 u_color4;\nuniform float u_dotSize;\nuniform float u_dotSizeRange;\nuniform float u_spreading;\n\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n\nfloat random(in vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n}\nvec2 random2(vec2 p) {\n return vec2(random(p), random(200. * p));\n}\n\nvec3 get_voronoi_shape(vec2 _uv, float time) {\n vec2 i_uv = floor(_uv);\n vec2 f_uv = fract(_uv);\n\n float min_dist = 1.;\n vec2 cell_randomizer = vec2(0.);\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec2 tile_offset = vec2(float(x), float(y));\n vec2 rand = random2(i_uv + tile_offset);\n vec2 cell_center = .5 + 1e-4 + .25 * clamp(u_spreading, 0., 1.) * sin(time + TWO_PI * rand);\n float dist = length(tile_offset + cell_center - f_uv);\n if (dist < min_dist) {\n min_dist = dist;\n cell_randomizer = rand;\n }\n min_dist = min(min_dist, dist);\n }\n }\n\n return vec3(min_dist, cell_randomizer);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n\n uv -= .5;\n float scale = .5 * u_scale + 1e-4;\n uv *= (.02 * (1. - step(1. - scale, 1.) / scale));\n uv *= u_resolution;\n uv /= u_pixelRatio;\n uv += .5;\n\n float t = u_time;\n\n vec3 voronoi = get_voronoi_shape(uv, t) + 1e-4;\n\n float radius = .25 * clamp(u_dotSize, 0., 1.) - .5 * clamp(u_dotSizeRange, 0., 1.) * voronoi[2];\n float dist = voronoi[0];\n float edge_width = fwidth(dist);\n float shape = smoothstep(radius + edge_width, radius - edge_width, dist);\n\n float color_randomizer = voronoi[1];\n\n float opacity =\n u_color1.a * step(0.0, color_randomizer) * step(color_randomizer, 0.25) +\n u_color2.a * step(0.25, color_randomizer) * step(color_randomizer, 0.5) +\n u_color3.a * step(0.5, color_randomizer) * step(color_randomizer, 0.75) +\n u_color4.a * step(0.75, color_randomizer) * step(color_randomizer, 1.0);\n\n opacity *= shape;\n\n vec3 color =\n u_color1.rgb * step(0.0, color_randomizer) * step(color_randomizer, 0.25) +\n u_color2.rgb * step(0.25, color_randomizer) * step(color_randomizer, 0.5) +\n u_color3.rgb * step(0.5, color_randomizer) * step(color_randomizer, 0.75) +\n u_color4.rgb * step(0.75, color_randomizer) * step(color_randomizer, 1.0);\n\n fragColor = vec4(color * opacity, opacity);\n}\n`;\n", "/** Possible values for the shape uniform */\nexport const DotGridShapes = {\n Circle: 0,\n Diamond: 1,\n Square: 2,\n Triangle: 3,\n} as const;\nexport type DotGridShape = (typeof DotGridShapes)[keyof typeof DotGridShapes];\n\nexport type DotGridUniforms = {\n u_colorFill: [number, number, number, number];\n u_colorStroke: [number, number, number, number];\n u_dotSize: number;\n u_gridSpacingX: number;\n u_gridSpacingY: number;\n u_strokeWidth: number;\n u_sizeRange: number;\n u_opacityRange: number;\n u_shape: DotGridShape;\n};\n\n/**\n * Dot Grid Pattern\n * (the size parameters are set in pixels)\n *\n * Uniforms include:\n * u_colorBack - the background color\n * u_colorFill - the fill color\n * u_colorStroke - the stroke color\n * u_dotSize (px) - the base dot radius\n * u_strokeWidth (px) - the stroke (to be subtracted from u_dotSize)\n * u_gridSpacingX (px) - horizontal grid spacing\n * u_gridSpacingY (px) - xertical grid spacing\n * u_sizeRange (0 .. 1) - variety of dot size\n * u_opacityRange(0 .. 1) - variety of dot opacity to be applied equally to fill and stroke\n * u_shape - shape code (0 - circle, 1 - diamond, 2 - square, 3 - triangle)\n */\n\nexport const dotGridFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform vec2 u_resolution;\nuniform float u_pixelRatio;\n\nuniform vec4 u_colorFill;\nuniform vec4 u_colorStroke;\nuniform float u_dotSize;\nuniform float u_gridSpacingX;\nuniform float u_gridSpacingY;\nuniform float u_strokeWidth;\nuniform float u_sizeRange;\nuniform float u_opacityRange;\nuniform float u_shape;\n\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\nfloat hash(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n}\n\nvec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\nfloat polygon(vec2 p, float N, float rot) {\n float a = atan(p.x, p.y) + rot;\n float r = TWO_PI / float(N);\n\n return cos(floor(.5 + a / r) * r - a) * length(p);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy;\n uv.y = u_resolution.y - uv.y;\n\n uv /= u_pixelRatio;\n\n vec2 grid = fract(uv / vec2(u_gridSpacingX, u_gridSpacingY)) + 1e-4;\n vec2 grid_idx = floor(uv / vec2(u_gridSpacingX, u_gridSpacingY));\n float sizeRandomizer = .5 + .8 * snoise(2. * vec2(grid_idx.x * 100., grid_idx.y));\n float opacity_randomizer = .5 + .7 * snoise(2. * vec2(grid_idx.y, grid_idx.x));\n\n vec2 center = vec2(0.5) - 1e-3;\n vec2 p = (grid - center) * vec2(u_gridSpacingX, u_gridSpacingY);\n\n float baseSize = u_dotSize * (1. - sizeRandomizer * u_sizeRange);\n float strokeWidth = u_strokeWidth;\n\n float dist;\n if (u_shape < 0.5) {\n // Circle\n dist = length(p);\n } else if (u_shape < 1.5) {\n // Diamond\n strokeWidth *= 1.5;\n dist = polygon(1.5 * p, 4., .25 * PI);\n } else if (u_shape < 2.5) {\n // Square\n dist = polygon(1.03 * p, 4., 1e-3);\n } else {\n // Triangle\n strokeWidth *= 1.5;\n p = p * 2. - 1.;\n p *= .9;\n p.y -= .75 * baseSize;\n dist = polygon(p, 3., 1e-3);\n }\n\n float edgeWidth = fwidth(dist);\n float shapeOuter = smoothstep(baseSize + edgeWidth + strokeWidth, baseSize - edgeWidth + strokeWidth, dist);\n float shapeInner = smoothstep(baseSize + edgeWidth, baseSize - edgeWidth, dist);\n float stroke = clamp(shapeOuter - shapeInner, 0., 1.);\n\n float dot_opacity = max(0., 1. - opacity_randomizer * u_opacityRange);\n\n vec3 color = u_colorFill.rgb * u_colorFill.a * dot_opacity * shapeInner;\n color = mix(color, u_colorStroke.rgb, u_colorStroke.a * dot_opacity * stroke);\n\n float opacity = u_colorFill.a * shapeInner * dot_opacity;\n opacity += u_colorStroke.a * stroke * dot_opacity;\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type SteppedSimplexNoiseUniforms = {\n u_scale: number;\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_color3: [number, number, number, number];\n u_color4: [number, number, number, number];\n u_color5: [number, number, number, number];\n u_steps_number: number;\n};\n\n/**\n * Stepped Simplex Noise by Ksenia Kondrashova\n * Calculates a combination of 2 simplex noises with result rendered as\n * an X-stepped 5-colored gradient\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_color1 - the first gradient color\n * u_color2 - the second gradient color\n * u_color3 - the third gradient color\n * u_color4 - the fourth gradient color\n * u_color5 - the fifth gradient color\n * u_steps_number - the number of solid colors to show as a stepped gradient\n */\n\nexport const steppedSimplexNoiseFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\n\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform vec4 u_color3;\nuniform vec4 u_color4;\nuniform vec4 u_color5;\nuniform float u_steps_number;\n\nout vec4 fragColor;\n\nvec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nfloat get_noise(vec2 uv, float t) {\n float noise = .5 * snoise(uv - vec2(0., .3 * t));\n noise += .5 * snoise(2. * uv + vec2(0., .32 * t));\n\n return noise;\n}\n\nvec4 getColor(int index) {\n if (index == 0) return u_color1;\n if (index == 1) return u_color2;\n if (index == 2) return u_color3;\n if (index == 3) return u_color4;\n if (index == 4) return u_color5;\n return u_color1;\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n\n uv -= .5;\n float scale = .5 * u_scale + 1e-4;\n uv *= (.0008 * (1. - step(1. - scale, 1.) / scale));\n uv *= u_resolution;\n uv /= u_pixelRatio;\n uv += .5;\n\n float t = u_time;\n\n float noise = .5 + .5 * get_noise(uv, t);\n noise = floor(noise * u_steps_number) / u_steps_number;\n\n vec3 color = u_color1.rgb * u_color1.a;\n float opacity = u_color1.a;\n for (int i = 0; i < 5; i++) {\n vec4 next_c = getColor(i + 1);\n float proportion = smoothstep((float(i) + .5) / 5., (float(i) + 2.) / 5., noise);\n color = mix(color, next_c.rgb * next_c.a, proportion);\n opacity = mix(opacity, next_c.a, proportion);\n }\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type MetaballsUniforms = {\n u_scale: number;\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_color3: [number, number, number, number];\n u_ballSize: number;\n u_visibilityRange: number;\n};\n\n/**\n * Metaballs (circular shapes with gooey effect applied)\n * The artwork by Ksenia Kondrashova\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * (with scale = 1 metaballs fit the screen height)\n * u_color1 - the mataballs gradient color #1\n * u_color2 - the mataballs gradient color #2\n * u_color3 - the mataballs gradient color #3\n * u_ballSize (0 .. 1) - the size coefficient applied to each ball\n * u_visibilityRange (0 .. 1) - to show 2 to 15 balls\n */\n\nexport const metaballsFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform vec4 u_color3;\nuniform float u_ballSize;\nuniform float u_visibilityRange;\n\n#define TWO_PI 6.28318530718\n\nout vec4 fragColor;\n\nfloat hash(float x) {\n return fract(sin(x) * 43758.5453123);\n}\nfloat lerp(float a, float b, float t) {\n return a + t * (b - a);\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); // Smoothstep function for interpolation\n return lerp(hash(i), hash(i + 1.0), u);\n}\n\nfloat get_ball_shape(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 uv = gl_FragCoord.xy / u_resolution.xy;\n float ratio = u_resolution.x / u_resolution.y;\n\n uv -= .5;\n float scale = .5 * u_scale + 1e-4;\n uv *= (9. * (1. - step(1. - scale, 1.) / scale));\n uv += .5;\n uv.x *= ratio;\n\n float t = u_time;\n\n vec3 total_color = vec3(0.);\n float total_shape = 0.;\n\n const int max_balls_number = 15;\n for (int i = 0; i < max_balls_number; i++) {\n vec2 pos = vec2(.5) + 1e-4;\n float idx_fract = float(i) / float(max_balls_number);\n float angle = TWO_PI * idx_fract;\n\n float speed = 1. - .2 * idx_fract;\n float noiseX = noise(angle * 10. + float(i) + t * speed);\n float noiseY = noise(angle * 20. + float(i) - t * speed);\n\n pos += 7. * (vec2(noiseX, noiseY) - .5);\n\n vec4 ball_color;\n if (i % 3 == 0) {\n ball_color = u_color1;\n } else if (i % 3 == 1) {\n ball_color = u_color2;\n } else {\n ball_color = u_color3;\n }\n\n float shape = get_ball_shape(uv, pos, 6. - 4. * u_ballSize) * ball_color.a;\n\n shape *= smoothstep((float(i) - 1.) / float(max_balls_number), idx_fract, u_visibilityRange);\n\n total_color += ball_color.rgb * shape;\n total_shape += shape;\n }\n\n total_color /= max(total_shape, 1e-4);\n\n float edge_width = fwidth(total_shape);\n float final_shape = smoothstep(.4, .4 + edge_width, total_shape);\n\n vec3 color = total_color * final_shape;\n float opacity = final_shape;\n\n if (opacity < .01) {\n discard;\n }\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type PerlinNoiseUniforms = {\n u_scale: number;\n u_color: [number, number, number, number];\n u_proportion: number;\n u_softness: number;\n u_octaveCount: number;\n u_persistence: number;\n u_lacunarity: number;\n};\n\n/**\n * 3d Perlin noise with exposed parameters rendered on the transparent background\n * Based on https://www.shadertoy.com/view/NlSGDz\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_color - the color\n * u_proportion (0 .. 1) - the proportion between u_color1 and u_color;\n * u_softness - the sharpness of the transition between u_color1 and u_color in the noise output\n * u_octaveCount - the number of octaves for Perlin noise;\n * higher values increase the complexity of the noise\n * u_persistence (0 .. 1) - the amplitude of each successive octave of the noise;\n * lower values make higher octaves less pronounced\n * u_lacunarity - the frequency of each successive octave of the noise;\n * higher values increase the detail\n */\n\nexport const perlinNoiseFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\nuniform vec4 u_color;\nuniform float u_proportion;\nuniform float u_softness;\nuniform float u_octaveCount;\nuniform float u_persistence;\nuniform float u_lacunarity;\n\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n\nuint hash(uint x, uint seed) {\n const uint m = 0x5bd1e995U;\n uint hash = seed;\n // process input\n uint k = x;\n k *= m;\n k ^= k >> 24;\n k *= m;\n hash *= m;\n hash ^= k;\n // some final mixing\n hash ^= hash >> 13;\n hash *= m;\n hash ^= hash >> 15;\n return hash;\n}\n\nuint hash(uvec3 x, uint seed){\n const uint m = 0x5bd1e995U;\n uint hash = seed;\n // process first vector element\n uint k = x.x; \n k *= m;\n k ^= k >> 24;\n k *= m;\n hash *= m;\n hash ^= k;\n // process second vector element\n k = x.y; \n k *= m;\n k ^= k >> 24;\n k *= m;\n hash *= m;\n hash ^= k;\n // process third vector element\n k = x.z; \n k *= m;\n k ^= k >> 24;\n k *= m;\n hash *= m;\n hash ^= k;\n // some final mixing\n hash ^= hash >> 13;\n hash *= m;\n hash ^= hash >> 15;\n return hash;\n}\n\n\nvec3 gradientdy(uint hash) {\n switch (int(hash) & 15) { // look at the last four bits to pick a gradient dy\n case 0:\n return vec3(1, 1, 0);\n case 1:\n return vec3(-1, 1, 0);\n case 2:\n return vec3(1, -1, 0);\n case 3:\n return vec3(-1, -1, 0);\n case 4:\n return vec3(1, 0, 1);\n case 5:\n return vec3(-1, 0, 1);\n case 6:\n return vec3(1, 0, -1);\n case 7:\n return vec3(-1, 0, -1);\n case 8:\n return vec3(0, 1, 1);\n case 9:\n return vec3(0, -1, 1);\n case 10:\n return vec3(0, 1, -1);\n case 11:\n return vec3(0, -1, -1);\n case 12:\n return vec3(1, 1, 0);\n case 13:\n return vec3(-1, 1, 0);\n case 14:\n return vec3(0, -1, 1);\n case 15:\n return vec3(0, -1, -1);\n }\n}\n\nfloat interpolate(float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, vec3 t) {\n return mix(\n mix(mix(value1, value2, t.x), mix(value3, value4, t.x), t.y),\n mix(mix(value5, value6, t.x), mix(value7, value8, t.x), t.y),\n t.z\n );\n}\n\nvec3 fade(vec3 t) {\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n\nfloat perlinNoise(vec3 position, uint seed) {\n position += 1e+4;\n vec3 floorPosition = floor(position);\n vec3 fractPosition = fract(position);\n uvec3 cellCoordinates = uvec3(floorPosition);\n float value1 = dot(gradientdy(hash(cellCoordinates, seed)), fractPosition);\n float value2 = dot(gradientdy(hash((cellCoordinates + uvec3(1, 0, 0)), seed)), fractPosition - vec3(1, 0, 0));\n float value3 = dot(gradientdy(hash((cellCoordinates + uvec3(0, 1, 0)), seed)), fractPosition - vec3(0, 1, 0));\n float value4 = dot(gradientdy(hash((cellCoordinates + uvec3(1, 1, 0)), seed)), fractPosition - vec3(1, 1, 0));\n float value5 = dot(gradientdy(hash((cellCoordinates + uvec3(0, 0, 1)), seed)), fractPosition - vec3(0, 0, 1));\n float value6 = dot(gradientdy(hash((cellCoordinates + uvec3(1, 0, 1)), seed)), fractPosition - vec3(1, 0, 1));\n float value7 = dot(gradientdy(hash((cellCoordinates + uvec3(0, 1, 1)), seed)), fractPosition - vec3(0, 1, 1));\n float value8 = dot(gradientdy(hash((cellCoordinates + uvec3(1, 1, 1)), seed)), fractPosition - vec3(1, 1, 1));\n return interpolate(value1, value2, value3, value4, value5, value6, value7, value8, fade(fractPosition));\n}\n\nfloat p_noise(vec3 position, int octaveCount, float persistence, float lacunarity) {\n float value = 0.0;\n float amplitude = 1.0;\n float currentFrequency = 10.;\n uint currentSeed = uint(0);\n for (int i = 0; i < octaveCount; i++) {\n currentSeed = hash(currentSeed, 0x0U);\n value += perlinNoise(position * currentFrequency, currentSeed) * amplitude;\n amplitude *= persistence;\n currentFrequency *= lacunarity;\n }\n return value;\n}\n\nfloat get_max_amp(float persistence, float octaveCount) {\n persistence *= .999;\n return (1. - pow(persistence, octaveCount)) / (1. - persistence);\n}\n\nvoid main() {\n\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n float t = .2 * u_time;\n\n uv -= .5;\n uv *= (.004 * u_scale * u_resolution);\n uv /= u_pixelRatio;\n uv += .5;\n \n vec3 p = vec3(uv, t);\n \n float oct_count = max(0., floor(u_octaveCount));\n float persistence = clamp(u_persistence, 0., 1.);\n float noise = p_noise(p, int(oct_count), persistence, u_lacunarity);\n \n float max_amp = get_max_amp(persistence, oct_count);\n float noise_normalized = (noise + max_amp) / (2. * max_amp) + (u_proportion - .5);\n float sharpness = clamp(u_softness, 0., 1.);\n float smooth_w = 0.5 * fwidth(noise_normalized);\n float sharp_noise = smoothstep(\n .5 - .5 * sharpness - smooth_w, \n .5 + .5 * sharpness + smooth_w, \n noise_normalized\n );\n\n vec3 color = u_color.rgb * u_color.a * sharp_noise;\n float opacity = u_color.a * sharp_noise;\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type VoronoiUniforms = {\n u_scale: number;\n u_colorCell1: [number, number, number, number];\n u_colorCell2: [number, number, number, number];\n u_colorCell3: [number, number, number, number];\n u_colorMid: [number, number, number, number];\n u_colorGradient: number;\n u_distance: number;\n u_edgesSize: number;\n u_edgesSoftness: number;\n u_middleSize: number;\n u_middleSoftness: number;\n};\n\n/**\n * Voronoi pattern\n * The artwork by Ksenia Kondrashova\n * Renders a number of circular shapes with gooey effect applied\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_colorCell1 - color #1 of mix used to fill the cell shape\n * u_colorCell2 - color #2 of mix used to fill the cell shape\n * u_colorCell3 - color #3 of mix used to fill the cell shape\n * u_colorMid - color used to fill the radial shape in the center of each cell\n * u_colorGradient (0 .. 1) - if the cell color is a gradient of palette colors or one color selection\n * u_distance (0 ... 0.5) - how far the cell center can move from regular square grid\n * u_edgesSize (0 .. 1) - the size of borders\n * (can be set to zero but the edge may get glitchy due to nature of Voronoi diagram)\n * u_edgesSoftness (0 .. 1) - the blur/sharp for cell border\n * u_middleSize (0 .. 1) - the size of shape in the center of each cell\n * u_middleSoftness (0 .. 1) - the smoothness of shape in the center of each cell\n * (vary from cell color gradient to sharp dot in the middle)\n */\n\nexport const voronoiFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\n\nuniform vec4 u_colorCell1;\nuniform vec4 u_colorCell2;\nuniform vec4 u_colorCell3;\nuniform vec4 u_colorMid;\n\nuniform float u_colorGradient;\nuniform float u_distance;\nuniform float u_edgesSize;\nuniform float u_edgesSoftness;\nuniform float u_middleSize;\nuniform float u_middleSoftness;\n\n#define TWO_PI 6.28318530718\n\nout vec4 fragColor;\n\nvec2 hash(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return fract(sin(p) * 18.5453);\n}\n\nfloat smin(float angle, float b, float k) {\n float h = clamp(.5 + .5 * (b - angle) / k, 0., 1.);\n return mix(b, angle, h) - k * h * (1. - h);\n}\n\nvec4 blend_colors(vec4 c1, vec4 c2, vec4 c3, vec2 randomizer) {\n vec3 color1 = c1.rgb * c1.a;\n vec3 color2 = c2.rgb * c2.a;\n vec3 color3 = c3.rgb * c3.a;\n\n float mixer = clamp(u_colorGradient, 0., 1.);\n float r1 = smoothstep(.5 - .5 * mixer, .5 + .5 * mixer, randomizer[0]);\n float r2 = smoothstep(.6 - .6 * mixer, .6 + .4 * mixer, randomizer[1]);\n vec3 blended_color_2 = mix(color1, color2, r1);\n float blended_opacity_2 = mix(c1.a, c2.a, r1);\n vec3 c = mix(blended_color_2, color3, r2);\n float o = mix(blended_opacity_2, c3.a, r2);\n \n return vec4(c, o);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n float t = u_time;\n uv -= .5;\n uv *= (.01 * u_scale * u_resolution);\n uv /= u_pixelRatio;\n uv += .5;\n\n vec2 i_uv = floor(uv);\n vec2 f_uv = fract(uv);\n\n vec2 randomizer = vec2(0.);\n vec3 distance = vec3(1.);\n\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec2 tile_offset = vec2(float(x), float(y));\n vec2 o = hash(i_uv + tile_offset);\n tile_offset += (.5 + clamp(u_distance, 0., .5) * sin(t + TWO_PI * o)) - f_uv;\n\n float dist = dot(tile_offset, tile_offset);\n float old_min_dist = distance.x;\n\n distance.z = max(distance.x, max(distance.y, min(distance.z, dist)));\n distance.y = max(distance.x, min(distance.y, dist));\n distance.x = min(distance.x, dist);\n\n if (old_min_dist > distance.x) {\n randomizer = o;\n }\n }\n }\n\n distance = sqrt(distance);\n\n distance = sqrt(distance);\n float cell_shape = min(smin(distance.z, distance.y, .1) - distance.x, 1.);\n\n float dot_shape = pow(distance.x, 2.) / (2. * clamp(u_middleSize, 0., 1.) + 1e-4);\n float dot_edge_width = fwidth(dot_shape);\n float dotSharp = clamp(1. - u_middleSoftness, 0., 1.);\n dot_shape = 1. - smoothstep(.5 * dotSharp - dot_edge_width, 1. - .5 * dotSharp, dot_shape);\n\n float cell_edge_width = fwidth(distance.x);\n float w = .7 * (clamp(u_edgesSize, 0., 1.) - .1);\n float edgeSharp = clamp(u_edgesSoftness, 0., 1.);\n cell_shape = smoothstep(w - cell_edge_width, w + edgeSharp, cell_shape);\n\n dot_shape *= cell_shape;\n\n vec4 cell_mix = blend_colors(u_colorCell1, u_colorCell2, u_colorCell3, randomizer);\n \n vec3 color = cell_mix.rgb * cell_shape;\n float opacity = cell_mix.a * cell_shape;\n\n color = mix(color, u_colorMid.rgb * u_colorMid.a, dot_shape);\n opacity = mix(opacity, u_colorMid.a, dot_shape);\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "export type WavesUniforms = {\n u_scale: number;\n u_rotation: number;\n u_color: [number, number, number, number];\n u_shape: number;\n u_frequency: number;\n u_amplitude: number;\n u_spacing: number;\n u_dutyCycle: number;\n u_softness: number;\n};\n\n/**\n * Waves static pattern on the transparent background\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_rotation - the rotation applied to user space\n * u_color - the wave color\n * u_shape (0 ... 3) - the line shaping coefficient, non-integer\n values allowed and produce mixed shapes\n - u_shape = 0 is zigzag\n - u_shape = 1 is perfect sine wave\n - u_shape = 2 is irregular wave #1\n - u_shape = 3 is irregular wave #2\n * u_frequency - the wave frequency\n * u_amplitude - the wave amplitude\n * u_spacing - the density of pattern lines\n * u_dutyCycle (0 ... 1) - the proportion of stroke width to the pattern step\n * u_softness (0 ... 1) - the blur applied to the lines edges\n */\n\nexport const wavesFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\nuniform float u_rotation;\n\nuniform vec4 u_color;\nuniform float u_shape;\nuniform float u_frequency;\nuniform float u_amplitude;\nuniform float u_spacing;\nuniform float u_dutyCycle;\nuniform float u_softness;\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\nout vec4 fragColor;\n\nvec2 rotate(vec2 uv, float th) {\n return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv;\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n\n uv -= .5;\n uv *= (.02 * max(0., u_scale) * u_resolution);\n uv = rotate(uv, u_rotation * .5 * PI);\n uv /= u_pixelRatio;\n uv += .5;\n\n float wave = .5 * cos(uv.x * u_frequency * TWO_PI);\n float zigzag = 2. * abs(fract(uv.x * u_frequency) - .5);\n float irregular = sin(uv.x * .25 * u_frequency * TWO_PI) * cos(uv.x * u_frequency * TWO_PI);\n float irregular2 = .75 * (sin(uv.x * u_frequency * TWO_PI) + .5 * cos(uv.x * .5 * u_frequency * TWO_PI));\n\n float offset = mix(zigzag, wave, smoothstep(0., 1., u_shape));\n offset = mix(offset, irregular, smoothstep(1., 2., u_shape));\n offset = mix(offset, irregular2, smoothstep(2., 3., u_shape));\n offset *= 2. * u_amplitude;\n \n float spacing = .02 + .98 * u_spacing;\n float shape = .5 + .5 * sin((uv.y + offset) * PI / spacing);\n \n float edge_width = .02 / (1. + abs(shape)) * (.001 + u_scale);\n edge_width += .5 * max(0., u_softness);\n float dc = clamp(1. - u_dutyCycle, 0., 1.);\n float s = smoothstep(dc - edge_width, dc + edge_width, shape);\n\n vec3 color = u_color.rgb * u_color.a * s;\n float opacity = u_color.a * s;\n \n fragColor = vec4(color, opacity);\n}\n`;\n", "export const PatternShapes = {\n Checks: 0,\n Stripes: 1,\n Edge: 2,\n} as const;\nexport type PatternShape = (typeof PatternShapes)[keyof typeof PatternShapes];\n\nexport type WarpUniforms = {\n u_scale: number;\n u_rotation: number;\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_color3: [number, number, number, number];\n u_proportion: number;\n u_softness: number;\n u_shape: PatternShape;\n u_shapeScale: number;\n u_distortion: number;\n u_swirl: number;\n u_swirlIterations: number;\n};\n\n/**\n * 3d Perlin noise with exposed parameters\n *\n * Uniforms include:\n * u_scale - the scale applied to user space\n * u_rotation - the rotation applied to user space\n * u_color1 - the first pattern color\n * u_color2 - the second pattern color\n * u_color3 - the third pattern color\n * u_proportion (0 .. 1) - the proportion between colors (on 0.5 colors are equally distributed)\n * u_softness (0 .. 1) - the color blur (0 for pronounced edges, 1 for gradient)\n * u_shape (0 ... 2) - the color pattern to be distorted with noise & swirl\n * - u_shape = 0 is checks\n * - u_shape = 1 is stripes\n * - u_shape = 2 is 2 halves of canvas (mapping the canvas height regardless of resolution)\n * u_shapeScale - the scale of color pattern (appies over the global scaling)\n * u_distortion - the noisy distortion over the UV coordinate (applied before the overlapping swirl)\n * u_swirl - the power of swirly distortion\n * u_swirlIterations - the number of swirl iterations (layering curves effect)\n *\n */\n\nexport const warpFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform float u_scale;\nuniform float u_rotation;\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform vec4 u_color3;\nuniform float u_proportion;\nuniform float u_softness;\nuniform float u_shape;\nuniform float u_shapeScale;\nuniform float u_distortion;\nuniform float u_swirl;\nuniform float u_swirlIterations;\n\n\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\nvec2 rotate(vec2 uv, float th) {\n return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv;\n}\n\nfloat random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n}\nfloat noise(vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n\n // Smoothstep for interpolation\n vec2 u = f * f * (3.0 - 2.0 * f);\n\n // Do the interpolation as two nested mix operations\n // If you try to do this in one big operation, there's enough precision loss to be off by 1px at cell boundaries\n float x1 = mix(a, b, u.x);\n float x2 = mix(c, d, u.x);\n return mix(x1, x2, u.y);\n\n}\n\nvec4 blend_colors(vec4 c1, vec4 c2, vec4 c3, float mixer, float edgesWidth, float edge_blur) {\n vec3 color1 = c1.rgb * c1.a;\n vec3 color2 = c2.rgb * c2.a;\n vec3 color3 = c3.rgb * c3.a;\n\n float r1 = smoothstep(.0 + .35 * edgesWidth, .7 - .35 * edgesWidth + .5 * edge_blur, mixer);\n float r2 = smoothstep(.3 + .35 * edgesWidth, 1. - .35 * edgesWidth + edge_blur, mixer);\n\n vec3 blended_color_2 = mix(color1, color2, r1);\n float blended_opacity_2 = mix(c1.a, c2.a, r1);\n\n vec3 c = mix(blended_color_2, color3, r2);\n float o = mix(blended_opacity_2, c3.a, r2);\n return vec4(c, o);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n vec2 uv_original = uv;\n\n float t = .5 * u_time;\n\n float noise_scale = .0005 + .006 * u_scale;\n\n uv -= .5;\n uv *= (noise_scale * u_resolution);\n uv = rotate(uv, u_rotation * .5 * PI);\n uv /= u_pixelRatio;\n uv += .5;\n\n float n1 = noise(uv * 1. + t);\n float n2 = noise(uv * 2. - t);\n float angle = n1 * TWO_PI;\n uv.x += 4. * u_distortion * n2 * cos(angle);\n uv.y += 4. * u_distortion * n2 * sin(angle);\n\n float iterations_number = ceil(clamp(u_swirlIterations, 1., 30.));\n for (float i = 1.; i <= iterations_number; i++) {\n uv.x += clamp(u_swirl, 0., 2.) / i * cos(t + i * 1.5 * uv.y);\n uv.y += clamp(u_swirl, 0., 2.) / i * cos(t + i * 1. * uv.x);\n }\n\n float proportion = clamp(u_proportion, 0., 1.);\n\n float shape = 0.;\n float mixer = 0.;\n if (u_shape < .5) {\n vec2 checks_shape_uv = uv * (.5 + 3.5 * u_shapeScale);\n shape = .5 + .5 * sin(checks_shape_uv.x) * cos(checks_shape_uv.y);\n mixer = shape + .48 * sign(proportion - .5) * pow(abs(proportion - .5), .5);\n } else if (u_shape < 1.5) {\n vec2 stripes_shape_uv = uv * (.25 + 3. * u_shapeScale);\n float f = fract(stripes_shape_uv.y);\n shape = smoothstep(.0, .55, f) * smoothstep(1., .45, f);\n mixer = shape + .48 * sign(proportion - .5) * pow(abs(proportion - .5), .5);\n } else {\n float sh = 1. - uv.y;\n sh -= .5;\n sh /= (noise_scale * u_resolution.y);\n sh += .5;\n float shape_scaling = .2 * (1. - u_shapeScale);\n shape = smoothstep(.45 - shape_scaling, .55 + shape_scaling, sh + .3 * (proportion - .5));\n mixer = shape;\n }\n\n vec4 color_mix = blend_colors(u_color1, u_color2, u_color3, mixer, 1. - clamp(u_softness, 0., 1.), .01 + .01 * u_scale);\n\n fragColor = vec4(color_mix.rgb, color_mix.a);\n}\n`;\n", "export type GodRaysUniforms = {\n u_offsetX: number;\n u_offsetY: number;\n u_colorBack: [number, number, number, number];\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_color3: [number, number, number, number];\n u_spotty: number;\n u_midSize: number;\n u_midIntensity: number;\n u_frequency: number;\n u_density: number;\n u_blending: number;\n};\n\n/**\n * GodRays pattern\n * The artwork by Ksenia Kondrashova\n * Renders a number of circular shapes with gooey effect applied\n *\n * Uniforms include:\n *\n * u_offsetX - left / right pan\n * u_offsetY - up / down pan\n * u_colorBack - background RGBA color\n * u_color1 - ray color #1 (also main color of middle spot)\n * u_color2 - ray color #2\n * u_color3 - ray color #3\n * u_frequency - the frequency of rays (the number of sectors)\n * u_spotty - the density of spots in the rings (higher = more spots)\n * u_midSize - the size of the central shape within the rings\n * u_midIntensity - the influence of the central shape on the rings\n * u_density (0 .. 1) - the number of visible rays\n * u_blending (0 .. 1) - blending mode (0 for color mix, 1 for additive blending)\n */\n\nexport const godRaysFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\nuniform vec4 u_colorBack;\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform vec4 u_color3;\n\nuniform float u_offsetX;\nuniform float u_offsetY;\n\nuniform float u_frequency;\nuniform float u_spotty;\nuniform float u_midSize;\nuniform float u_midIntensity;\nuniform float u_density;\nuniform float u_blending;\n\nout vec4 fragColor;\n\n#define TWO_PI 6.28318530718\n\nfloat random(vec2 uv) {\n return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453123);\n}\n\nvec2 rotate(vec2 uv, float th) {\n return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv;\n}\n\nfloat noise(vec2 uv) {\n vec2 i = floor(uv);\n vec2 f = fract(uv);\n\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n\n float x1 = mix(a, b, u.x);\n float x2 = mix(c, d, u.x);\n return mix(x1, x2, u.y);\n}\n\nfloat get_noise_shape(vec2 uv, float r, float freq, float density, float time) {\n uv = rotate(uv, .05 * time);\n float a = atan(uv.y, uv.x);\n r -= 3. * time;\n vec2 left = vec2(a * freq, r);\n vec2 right = vec2(mod(a, TWO_PI) * freq, r);\n float n_left = pow(noise(left), density);\n float n_right = pow(noise(right), density);\n float shape = mix(n_right, n_left, smoothstep(-.2, .2, uv.x));\n return shape;\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n float ratio = u_resolution.x / u_resolution.y;\n\n uv -= .5;\n uv += vec2(-u_offsetX, u_offsetY);\n uv.x *= ratio;\n\n float t = .2 * u_time;\n\n float radius = length(uv);\n float spots = 4. * abs(u_spotty);\n float density = 4. - 3. * clamp(u_density, 0., 1.);\n\n float rays1 = get_noise_shape(uv, radius * spots, 5. * u_frequency, density, t);\n rays1 *= get_noise_shape(uv, .5 + .75 * radius * spots, 4. * u_frequency, density, -.5 * t);\n \n float rays2 = get_noise_shape(uv, 1.5 * radius, 12. * u_frequency, density, t);\n rays2 *= get_noise_shape(uv, -.5 + 1.1 * radius * spots, 7. * u_frequency, density, .75 * t);\n \n float rays3 = get_noise_shape(uv, 2. * radius * spots, 10. * u_frequency, density, t);\n rays3 *= get_noise_shape(uv, 1.1 * radius, 12. * u_frequency, density, .2 * t);\n\n float mid_shape = smoothstep(1. * abs(u_midSize), .05 * abs(u_midSize), radius); \n rays3 = mix(rays3, 1., (.5 + .5 * rays1) * u_midIntensity * pow(mid_shape, 7.));\n rays2 = mix(rays2, 1., (.5 + .5 * rays3) * u_midIntensity * pow(mid_shape, 3.));\n rays1 = mix(rays1, 1., u_midIntensity * pow(mid_shape, 5.));\n \n float opacity = rays2 * u_color2.a;\n opacity += rays3 * u_color3.a;\n opacity += rays1 * u_color1.a;\n opacity += u_colorBack.a * (1.0 - rays1 * u_color1.a - rays2 * u_color2.a - rays3 * u_color3.a);\n opacity = clamp(opacity, 0.0, 1.0);\n\n vec3 added_color = u_colorBack.rgb * (1. - (rays1 + rays2 + rays3)) * u_colorBack.a;\n added_color += u_color1.rgb * rays1 * u_color1.a;\n added_color += u_color2.rgb * rays2 * u_color2.a;\n added_color += u_color3.rgb * rays3 * u_color3.a;\n\n added_color += u_colorBack.rgb * rays1 * (1.0 - u_color1.a) * u_colorBack.a;\n added_color += u_colorBack.rgb * rays2 * (1.0 - u_color2.a) * u_colorBack.a;\n added_color += u_colorBack.rgb * rays3 * (1.0 - u_color3.a) * u_colorBack.a;\n \n vec3 mixed_color = mix(u_colorBack.rgb * u_colorBack.a, u_color2.rgb, rays2 * u_color2.a);\n mixed_color = mix(mixed_color, u_color3.rgb, rays3 * u_color3.a);\n mixed_color = mix(mixed_color, u_color1.rgb, rays1 * u_color1.a);\n \n vec3 color = mix(mixed_color, added_color, clamp(u_blending, 0., 1.));\n \n fragColor = vec4(color, opacity);\n}\n`;\n", "export type SpiralUniforms = {\n u_color1: [number, number, number, number];\n u_color2: [number, number, number, number];\n u_scale: number;\n u_offsetX: number;\n u_offsetY: number;\n u_spiralDensity: number;\n u_spiralDistortion: number;\n u_strokeWidth: number;\n u_strokeTaper: number;\n u_strokeCap: number;\n u_noiseFreq: number;\n u_noisePower: number;\n u_softness: number;\n};\n\n/**\n * Spiral shape\n * The artwork by Ksenia Kondrashova\n * Generates a dynamic spiral shape with configurable parameters\n *\n * Uniforms include:\n *\n * u_scale - controls the overall scale of the spiral (u_scale = 1 makes it fit the viewport height)\n * u_offsetX - left / right pan\n * u_offsetY - up / down pan\n * u_color1 - the first color used in the spiral (stroke)\n * u_color2 - the second color used in the spiral (back)\n * u_spiralDensity (0 .. 1) - the spacing of the spiral arms\n * u_spiralDistortion (0 .. 1) - adds a wavy distortion effect to the spiral arms\n * u_strokeWidth (0 .. 1) - defines the thickness of the spiral lines.\n * u_strokeCap (0 .. 1) - adjusts the fading of the spiral edges.\n * u_strokeTaper (0 .. 1) - controls the tapering effect along the spiral arms.\n * u_noiseFreq - frequency of the noise applied to the spiral.\n * u_noisePower (0 .. 1) - strength of the noise effect.\n * u_softness - softens the edges of the spiral for a smoother appearance.\n */\n\nexport const spiralFragmentShader = `#version 300 es\nprecision highp float;\n\nuniform float u_scale;\nuniform float u_offsetX;\nuniform float u_offsetY;\n\nuniform vec4 u_color1;\nuniform vec4 u_color2;\nuniform float u_spiralDensity;\nuniform float u_spiralDistortion;\nuniform float u_strokeWidth;\nuniform float u_strokeCap;\nuniform float u_strokeTaper;\n\nuniform float u_noiseFreq;\nuniform float u_noisePower;\nuniform float u_softness;\n\nuniform float u_time;\nuniform float u_pixelRatio;\nuniform vec2 u_resolution;\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\nout vec4 fragColor;\n\nvec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n float ratio = u_resolution.x / u_resolution.y;\n\n uv -= .5;\n uv += vec2(-u_offsetX, u_offsetY);\n\n uv *= (.4 + 15. * u_scale);\n uv.x *= ratio;\n\n float t = u_time;\n\n float l = length(uv);\n float angle = atan(uv.y, uv.x) - 2. * t;\n float angle_norm = angle / TWO_PI; \n\n angle_norm += .125 * u_noisePower * snoise(.5 * u_noiseFreq * uv);\n\n float offset = pow(l, 1. - clamp(u_spiralDensity, 0., 1.)) + angle_norm;\n \n float stripe_map = fract(offset);\n stripe_map -= .5 * u_strokeTaper * l;\n \n stripe_map += .25 * u_noisePower * snoise(u_noiseFreq * uv);\n\n float shape = 2. * abs(stripe_map - .5);\n \n shape *= (1. + u_spiralDistortion * sin(4. * l - t) * cos(PI + l + t));\n \n float stroke_width = clamp(u_strokeWidth, fwidth(l), 1. - fwidth(l));\n\n float edge_width = min(fwidth(l), fwidth(offset));\n\n float mid = 1. - smoothstep(.0, .9, l);\n mid = pow(mid, 2.);\n shape -= .5 * u_strokeCap * mid;\n \n shape = smoothstep(stroke_width - edge_width - u_softness, stroke_width + edge_width + u_softness, shape);\n\n vec3 color = mix(u_color1.rgb * u_color1.a, u_color2.rgb * u_color2.a, shape);\n float opacity = mix(u_color1.a, u_color2.a, shape);\n\n fragColor = vec4(color, opacity);\n}\n`;\n", "/** Convert color string from HSL, RGB, or hex to 0-to-1-range-RGBA array */\nexport function getShaderColorFromString(\n colorString: string | [number, number, number] | [number, number, number, number] | undefined,\n fallback: string | [number, number, number] | [number, number, number, number] = [0, 0, 0, 1]\n): [number, number, number, number] {\n // If the color string is already an array of 3 or 4 numbers, return it (with alpha=1 if needed)\n if (Array.isArray(colorString)) {\n if (colorString.length === 4) return colorString as [number, number, number, number];\n if (colorString.length === 3) return [...colorString, 1];\n return getShaderColorFromString(fallback);\n }\n\n // If the color string is not a string, return the fallback\n if (typeof colorString !== 'string') {\n return getShaderColorFromString(fallback);\n }\n\n let r: number,\n g: number,\n b: number,\n a = 1;\n if (colorString.startsWith('#')) {\n [r, g, b, a] = hexToRgba(colorString);\n } else if (colorString.startsWith('rgb')) {\n [r, g, b, a] = parseRgba(colorString);\n } else if (colorString.startsWith('hsl')) {\n [r, g, b, a] = hslaToRgba(parseHsla(colorString));\n } else {\n console.error('Unsupported color format', colorString);\n return getShaderColorFromString(fallback);\n }\n\n return [clamp(r, 0, 1), clamp(g, 0, 1), clamp(b, 0, 1), clamp(a, 0, 1)];\n}\n\n/** Convert hex to RGBA (0 to 1 range) */\nfunction hexToRgba(hex: string): [number, number, number, number] {\n // Remove # if present\n hex = hex.replace(/^#/, '');\n\n // Expand three-letter hex to six-letter\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('');\n }\n // Expand six-letter hex to eight-letter (add full opacity if no alpha)\n if (hex.length === 6) {\n hex = hex + 'ff';\n }\n\n // Parse the components\n const r = parseInt(hex.slice(0, 2), 16) / 255;\n const g = parseInt(hex.slice(2, 4), 16) / 255;\n const b = parseInt(hex.slice(4, 6), 16) / 255;\n const a = parseInt(hex.slice(6, 8), 16) / 255;\n\n return [r, g, b, a];\n}\n\n/** Parse RGBA string to RGBA (0 to 1 range) */\nfunction parseRgba(rgba: string): [number, number, number, number] {\n // Match both rgb and rgba patterns\n const match = rgba.match(/^rgba?\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*([0-9.]+))?\\s*\\)$/i);\n if (!match) return [0, 0, 0, 1];\n\n return [\n parseInt(match[1] ?? '0') / 255,\n parseInt(match[2] ?? '0') / 255,\n parseInt(match[3] ?? '0') / 255,\n match[4] === undefined ? 1 : parseFloat(match[4]),\n ];\n}\n\n/** Parse HSLA string */\nfunction parseHsla(hsla: string): [number, number, number, number] {\n const match = hsla.match(/^hsla?\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*(?:,\\s*([0-9.]+))?\\s*\\)$/i);\n if (!match) return [0, 0, 0, 1];\n\n return [\n parseInt(match[1] ?? '0'),\n parseInt(match[2] ?? '0'),\n parseInt(match[3] ?? '0'),\n match[4] === undefined ? 1 : parseFloat(match[4]),\n ];\n}\n\n/** Convert HSLA to RGBA (0 to 1 range) */\nfunction hslaToRgba(hsla: [number, number, number, number]): [number, number, number, number] {\n const [h, s, l, a] = hsla;\n const hDecimal = h / 360;\n const sDecimal = s / 100;\n const lDecimal = l / 100;\n let r, g, b;\n\n if (s === 0) {\n r = g = b = lDecimal; // achromatic\n } else {\n const hue2rgb = (p: number, q: number, t: number) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n\n const q = lDecimal < 0.5 ? lDecimal * (1 + sDecimal) : lDecimal + sDecimal - lDecimal * sDecimal;\n const p = 2 * lDecimal - q;\n r = hue2rgb(p, q, hDecimal + 1 / 3);\n g = hue2rgb(p, q, hDecimal);\n b = hue2rgb(p, q, hDecimal - 1 / 3);\n }\n\n return [r, g, b, a];\n}\n\nexport const clamp = (n: number, min: number, max: number): number => Math.min(Math.max(n, min), max);\n"],
5
- "mappings": ";AAQO,SAASA,EAAwBC,EAA0D,CAChG,MAAO,qBAAsBA,CAC/B,CAEO,IAAMC,EAAN,KAAkB,CAChB,WACA,OACC,GACA,QAA+B,KAC/B,iBAAgE,CAAC,EAEjE,eAEA,MAAuB,KAEvB,eAAiB,EAEjB,eAAiB,EAEjB,MAAQ,EAER,iBAEA,gBAAkB,GAElB,kBAAoB,GAEpB,SAAsC,IAAI,IAE1C,cAAgB,EAExB,YAEEC,EACAC,EACAC,EAAgC,CAAC,EACjCC,EAEAC,EAAQ,EAERC,EAAQ,EAERC,EAAgB,KAChB,CAEA,IAAMC,EAAS,SAAS,cAAc,QAAQ,EAC9CP,EAAW,MAAM,QAAU,SAC3BA,EAAW,MAAM,SAAW,WAC5BO,EAAO,MAAM,SAAW,WACxBA,EAAO,MAAM,MAAQ,IACrBA,EAAO,MAAM,OAAS,KACtBA,EAAO,MAAM,MAAQ,OACrBA,EAAO,MAAM,OAAS,OACtB,KAAK,OAASA,EACd,KAAK,WAAaP,EAClBA,EAAW,YAAYO,CAAM,EAC7B,KAAK,eAAiBN,EACtB,KAAK,iBAAmBC,EAExB,KAAK,eAAiBG,EACtB,KAAK,cAAgBC,EAErB,IAAME,EAAKD,EAAO,WAAW,SAAUJ,CAAsB,EAC7D,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,qBAAqB,EAEvC,KAAK,GAAKA,EAEV,KAAK,YAA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AASA,EAAM,CAAC,GAAK,GAAG,EACxB,SAASA,EAAM,CAAC,GAAK,GAAG,EACxB,SAASA,EAAM,CAAC,GAAK,GAAG,EACxBA,EAAM,CAAC,IAAM,OAAY,EAAI,WAAWA,EAAM,CAAC,CAAC,CAClD,EAPmB,CAAC,EAAG,EAAG,EAAG,CAAC,CAQhC,CAGA,SAASP,EAAWQ,EAA0E,CAC5F,GAAM,CAACC,EAAGC,EAAGC,EAAGN,CAAC,EAAIG,EACfI,EAAWH,EAAI,IACfI,EAAWH,EAAI,IACfI,EAAWH,EAAI,IACjBhB,EAAGC,EAAGC,EAEV,GAAIa,IAAM,EACRf,EAAIC,EAAIC,EAAIiB,MACP,CACL,IAAMC,EAAU,CAACC,EAAWC,EAAWC,KACjCA,EAAI,IAAGA,GAAK,GACZA,EAAI,IAAGA,GAAK,GACZA,EAAI,mBAAcF,GAAKC,EAAID,GAAK,EAAIE,EACpCA,EAAI,GAAcD,EAClBC,EAAI,kBAAcF,GAAKC,EAAID,IAAM,kBAAQE,GAAK,EAC3CF,GAGHC,EAAIH,EAAW,GAAMA,GAAY,EAAID,GAAYC,EAAWD,EAAWC,EAAWD,EAClFG,EAAI,EAAIF,EAAWG,EACzBtB,EAAIoB,EAAQC,EAAGC,EAAGL,EAAW,EAAI,CAAC,EAClChB,EAAImB,EAAQC,EAAGC,EAAGL,CAAQ,EAC1Bf,EAAIkB,EAAQC,EAAGC,EAAGL,EAAW,EAAI,CAAC,CACpC,CAEA,MAAO,CAACjB,EAAGC,EAAGC,EAAGQ,CAAC,CACpB,CAEO,IAAMH,EAAQ,CAACiB,EAAWC,EAAaC,IAAwB,KAAK,IAAI,KAAK,IAAIF,EAAGC,CAAG,EAAGC,CAAG",
6
- "names": ["isPaperShaderDivWrapper", "div", "ShaderMount", "mountToDiv", "fragmentShader", "uniforms", "webGlContextAttributes", "speed", "frame", "maxResolution", "canvas", "gl", "program", "createProgram", "vertexShaderSource", "positionAttributeLocation", "positionBuffer", "positions", "uniformLocations", "key", "value", "aspectRatioUniformName", "clientWidth", "clientHeight", "pixelRatio", "newWidth", "newHeight", "currentTime", "dt", "uniformName", "image", "existingTexture", "texture", "error", "location", "textureUnit", "aspectRatioLocation", "aspectRatio", "updatedUniforms", "newFrame", "newSpeed", "newUniforms", "createShader", "type", "source", "shader", "fragmentShaderSource", "vertexShader", "meshGradientFragmentShader", "smokeRingFragmentShader", "neuroNoiseFragmentShader", "dotOrbitFragmentShader", "DotGridShapes", "dotGridFragmentShader", "steppedSimplexNoiseFragmentShader", "metaballsFragmentShader", "perlinNoiseFragmentShader", "voronoiFragmentShader", "wavesFragmentShader", "PatternShapes", "warpFragmentShader", "godRaysFragmentShader", "spiralFragmentShader", "getShaderColorFromString", "colorString", "fallback", "r", "g", "b", "hexToRgba", "parseRgba", "hslaToRgba", "parseHsla", "clamp", "hex", "char", "a", "rgba", "match", "hsla", "h", "s", "l", "hDecimal", "sDecimal", "lDecimal", "hue2rgb", "p", "q", "t", "n", "min", "max"]
5
+ "mappings": ";;;AAQO,SAAS,wBAAwB,KAA0D;AAChG,SAAO,sBAAsB;AAC/B;AAEO,IAAM,cAAN,MAAkB;AAAA,EAChB;AAAA,EACA;AAAA,EACC;AAAA,EACA,UAA+B;AAAA,EAC/B,mBAAgE,CAAC;AAAA;AAAA,EAEjE;AAAA;AAAA,EAEA,QAAuB;AAAA;AAAA,EAEvB,iBAAiB;AAAA;AAAA,EAEjB,iBAAiB;AAAA;AAAA,EAEjB,QAAQ;AAAA;AAAA,EAER;AAAA;AAAA,EAEA,kBAAkB;AAAA;AAAA,EAElB,oBAAoB;AAAA;AAAA,EAEpB,WAAsC,oBAAI,IAAI;AAAA;AAAA,EAE9C,gBAAgB;AAAA;AAAA,EAExB,YAEE,YACA,gBACA,WAAgC,CAAC,GACjC,wBAEA,QAAQ,GAER,QAAQ,GAER,gBAAgB,MAChB;AAEA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,eAAW,MAAM,UAAU;AAC3B,eAAW,M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,IAAI,WAAW;AACzB,QAAI,QAAQ,GAAG,GAAG,WAAW,IAAI,CAAC;AAClC,QAAI,QAAQ,GAAG,GAAG,QAAQ;AAC1B,QAAI,QAAQ,GAAG,GAAG,WAAW,IAAI,CAAC;AAAA,EACpC;AAEA,SAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AACpB;AAEO,IAAM,QAAQ,CAAC,GAAW,KAAa,QAAwB,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,GAAG,GAAG;",
6
+ "names": ["vertexShaderSource", "p", "q"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paper-design/shaders",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {