@paper-design/shaders 0.0.80 → 0.0.82
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.d.ts +2 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +2 -2
- package/dist/shader-mount.d.ts +2 -0
- package/dist/shader-mount.js +16 -5
- package/dist/shader-mount.js.map +2 -2
- package/dist/shaders/color-panels.d.ts +1 -1
- package/dist/shaders/color-panels.js +1 -1
- package/dist/shaders/color-panels.js.map +1 -1
- package/dist/shaders/dot-grid.d.ts +2 -2
- package/dist/shaders/dot-grid.js.map +1 -1
- package/dist/shaders/dot-orbit.d.ts +2 -2
- package/dist/shaders/dot-orbit.js.map +1 -1
- package/dist/shaders/fluted-glass.d.ts +6 -8
- package/dist/shaders/fluted-glass.js +18 -15
- package/dist/shaders/fluted-glass.js.map +2 -2
- package/dist/shaders/gem-smoke.d.ts +8 -6
- package/dist/shaders/gem-smoke.js +5 -17
- package/dist/shaders/gem-smoke.js.map +2 -2
- package/dist/shaders/god-rays.d.ts +3 -3
- package/dist/shaders/god-rays.js.map +1 -1
- package/dist/shaders/grain-gradient.d.ts +0 -2
- package/dist/shaders/grain-gradient.js +0 -2
- package/dist/shaders/grain-gradient.js.map +2 -2
- package/dist/shaders/halftone-cmyk.d.ts +11 -12
- package/dist/shaders/halftone-cmyk.js +5 -2
- package/dist/shaders/halftone-cmyk.js.map +2 -2
- package/dist/shaders/halftone-dots.d.ts +5 -7
- package/dist/shaders/halftone-dots.js +17 -17
- package/dist/shaders/halftone-dots.js.map +2 -2
- package/dist/shaders/heatmap.d.ts +2 -3
- package/dist/shaders/heatmap.js +0 -1
- package/dist/shaders/heatmap.js.map +2 -2
- package/dist/shaders/image-dithering.d.ts +5 -7
- package/dist/shaders/image-dithering.js +0 -2
- package/dist/shaders/image-dithering.js.map +2 -2
- package/dist/shaders/lens-distortion.d.ts +15 -15
- package/dist/shaders/lens-distortion.js.map +1 -1
- package/dist/shaders/liquid-metal.d.ts +2 -3
- package/dist/shaders/liquid-metal.js +4 -1
- package/dist/shaders/liquid-metal.js.map +2 -2
- package/dist/shaders/mesh-gradient.js +15 -11
- package/dist/shaders/mesh-gradient.js.map +2 -2
- package/dist/shaders/metaballs.d.ts +2 -2
- package/dist/shaders/metaballs.js +0 -1
- package/dist/shaders/metaballs.js.map +2 -2
- package/dist/shaders/neuro-noise.d.ts +1 -3
- package/dist/shaders/neuro-noise.js +0 -2
- package/dist/shaders/neuro-noise.js.map +2 -2
- package/dist/shaders/paper-texture.d.ts +65 -34
- package/dist/shaders/paper-texture.js +443 -164
- package/dist/shaders/paper-texture.js.map +2 -2
- package/dist/shaders/perlin-noise.d.ts +3 -3
- package/dist/shaders/perlin-noise.js +0 -6
- package/dist/shaders/perlin-noise.js.map +2 -2
- package/dist/shaders/pulsing-border.d.ts +2 -2
- package/dist/shaders/pulsing-border.js.map +1 -1
- package/dist/shaders/simplex-noise.d.ts +2 -3
- package/dist/shaders/simplex-noise.js +11 -19
- package/dist/shaders/simplex-noise.js.map +2 -2
- package/dist/shaders/smoke-ring.d.ts +1 -1
- package/dist/shaders/smoke-ring.js.map +1 -1
- package/dist/shaders/spiral.d.ts +3 -3
- package/dist/shaders/spiral.js +3 -1
- package/dist/shaders/spiral.js.map +2 -2
- package/dist/shaders/static-mesh-gradient.d.ts +2 -2
- package/dist/shaders/static-mesh-gradient.js +15 -12
- package/dist/shaders/static-mesh-gradient.js.map +2 -2
- package/dist/shaders/static-radial-gradient.d.ts +4 -4
- package/dist/shaders/static-radial-gradient.js +15 -11
- package/dist/shaders/static-radial-gradient.js.map +2 -2
- package/dist/shaders/swirl.d.ts +3 -3
- package/dist/shaders/swirl.js +3 -1
- package/dist/shaders/swirl.js.map +2 -2
- package/dist/shaders/voronoi.d.ts +3 -3
- package/dist/shaders/voronoi.js.map +1 -1
- package/dist/shaders/warp.d.ts +2 -4
- package/dist/shaders/warp.js +0 -2
- package/dist/shaders/warp.js.map +2 -2
- package/dist/shaders/water.d.ts +6 -6
- package/dist/shaders/water.js +4 -2
- package/dist/shaders/water.js.map +2 -2
- package/dist/shaders/waves.d.ts +3 -3
- package/dist/shaders/waves.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shaders/neuro-noise.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ShaderMotionParams } from '../shader-mount.js';\nimport { type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing.js';\nimport { rotation2, colorBandingFix } from '../shader-utils.js';\n\n/**\n * A glowing, web-like structure of fluid lines and soft intersections.\n * Great for creating atmospheric, organic-yet-futuristic visuals.\n *\n * Fragment shader uniforms:\n * - u_time (float): Animation time\n * -
|
|
5
|
-
"mappings": ";;;;;AACA,eAAmE;AACnE,SAAS,WAAW,uBAAuB;
|
|
4
|
+
"sourcesContent": ["import type { ShaderMotionParams } from '../shader-mount.js';\nimport { type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing.js';\nimport { rotation2, colorBandingFix } from '../shader-utils.js';\n\n/**\n * A glowing, web-like structure of fluid lines and soft intersections.\n * Great for creating atmospheric, organic-yet-futuristic visuals.\n *\n * Fragment shader uniforms:\n * - u_time (float): Animation time\n * - u_colorFront (vec4): Graphics highlight color in RGBA\n * - u_colorMid (vec4): Graphics main color in RGBA\n * - u_colorBack (vec4): Background color in RGBA\n * - u_brightness (float): Luminosity of the crossing points (0 to 1)\n * - u_contrast (float): Sharpness of the transition between colorMid and colorBack (0 to 1)\n *\n * Vertex shader outputs (used in fragment shader):\n * - v_patternUV (vec2): UV coordinates for pattern with global sizing (rotation, scale, offset, etc) applied\n *\n * Vertex shader uniforms:\n * - u_resolution (vec2): Canvas resolution in pixels\n * - u_pixelRatio (float): Device pixel ratio\n * - u_originX (float): Reference point for positioning world width in the canvas (0 to 1)\n * - u_originY (float): Reference point for positioning world height in the canvas (0 to 1)\n * - u_worldWidth (float): Virtual width of the graphic before it's scaled to fit the canvas\n * - u_worldHeight (float): Virtual height of the graphic before it's scaled to fit the canvas\n * - u_fit (float): How to fit the rendered shader into the canvas dimensions (0 = none, 1 = contain, 2 = cover)\n * - u_scale (float): Overall zoom level of the graphics (0.01 to 4)\n * - u_rotation (float): Overall rotation angle of the graphics in degrees (0 to 360)\n * - u_offsetX (float): Horizontal offset of the graphics center (-1 to 1)\n * - u_offsetY (float): Vertical offset of the graphics center (-1 to 1)\n *\n * Original algorithm: https://x.com/zozuar/status/1625182758745128981/\n */\n\n// language=GLSL\nexport const neuroNoiseFragmentShader: string = `#version 300 es\nprecision mediump float;\n\nuniform float u_time;\n\nuniform vec4 u_colorFront;\nuniform vec4 u_colorMid;\nuniform vec4 u_colorBack;\nuniform float u_brightness;\nuniform float u_contrast;\n\nin vec2 v_patternUV;\n\nout vec4 fragColor;\n\n${ rotation2 }\n\nfloat neuroShape(vec2 uv, float t) {\n vec2 sine_acc = vec2(0.);\n vec2 res = vec2(0.);\n float scale = 8.;\n\n for (int j = 0; j < 15; j++) {\n uv = rotate(uv, 1.);\n sine_acc = rotate(sine_acc, 1.);\n vec2 layer = uv * scale + float(j) + sine_acc - t;\n sine_acc += sin(layer);\n res += (.5 + .5 * cos(layer)) / scale;\n scale *= (1.2);\n }\n return res.x + res.y;\n}\n\nvoid main() {\n vec2 shape_uv = v_patternUV;\n shape_uv *= .13;\n\n float t = .5 * u_time;\n\n float noise = neuroShape(shape_uv, t);\n\n noise = (1. + u_brightness) * noise * noise;\n noise = pow(noise, .7 + 6. * u_contrast);\n noise = min(1.4, noise);\n\n float blend = smoothstep(0.7, 1.4, noise);\n\n vec4 frontC = u_colorFront;\n frontC.rgb *= frontC.a;\n vec4 midC = u_colorMid;\n midC.rgb *= midC.a;\n vec4 blendFront = mix(midC, frontC, blend);\n\n float safeNoise = max(noise, 0.0);\n vec3 color = blendFront.rgb * safeNoise;\n float opacity = clamp(blendFront.a * safeNoise, 0., 1.);\n\n vec3 bgColor = u_colorBack.rgb * u_colorBack.a;\n color = color + bgColor * (1. - opacity);\n opacity = opacity + u_colorBack.a * (1. - opacity);\n\n ${ colorBandingFix }\n\n fragColor = vec4(color, opacity);\n}\n`;\n\nexport interface NeuroNoiseUniforms extends ShaderSizingUniforms {\n u_colorFront: [number, number, number, number];\n u_colorMid: [number, number, number, number];\n u_colorBack: [number, number, number, number];\n u_brightness: number;\n u_contrast: number;\n}\n\nexport interface NeuroNoiseParams extends ShaderSizingParams, ShaderMotionParams {\n colorFront?: string;\n colorMid?: string;\n colorBack?: string;\n brightness?: number;\n contrast?: number;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AACA,eAAmE;AACnE,SAAS,WAAW,uBAAuB;AAkCpC,MAAM,2BAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe7C,SAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA8CR,eAAgB;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
import type { ShaderMotionParams } from '../shader-mount.js';
|
|
2
2
|
import { type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-sizing.js';
|
|
3
|
+
export declare const paperTextureMeta: {
|
|
4
|
+
readonly maxCrumpleCount: 15;
|
|
5
|
+
};
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
7
|
+
* Static paper-like texture built from a combination of grain, noise and multiple fold patterns.
|
|
8
|
+
* Works as an image filter or as a standalone texture.
|
|
6
9
|
*
|
|
7
10
|
* Fragment shader uniforms:
|
|
8
|
-
* - u_resolution (vec2): Canvas resolution in pixels
|
|
9
|
-
* - u_pixelRatio (float): Device pixel ratio
|
|
10
11
|
* - u_image (sampler2D): Optional source image texture
|
|
12
|
+
* - u_isImage (bool): Whether a source image was provided
|
|
11
13
|
* - u_imageAspectRatio (float): Aspect ratio of the source image
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
22
|
-
* -
|
|
23
|
-
* -
|
|
24
|
-
* -
|
|
14
|
+
* - u_colorBack (vec4): Color behind the paper sheet in RGBA
|
|
15
|
+
* - u_colorPaper (vec4): Color of the paper sheet in RGBA
|
|
16
|
+
* - u_colorShadow (vec4): Color of the patterns over the paper sheet in RGBA
|
|
17
|
+
* - u_blending (float): Amount of image-to-paper blending, needs image (0 to 1)
|
|
18
|
+
* - u_distortion (float): How much the image bends with the paper surface, needs image (-1 to 1)
|
|
19
|
+
* - u_clip (bool): Cuts the paper sheet to the image frame, needs image
|
|
20
|
+
* - u_angle (float): Direction the surface is lit from in degrees, also the roughness rows direction, needs crumples, wrinkles, folds, roughnessRows or drops > 0 (0 to 360)
|
|
21
|
+
* - u_seed (float): Seed applied to every pattern (0 to 1000)
|
|
22
|
+
* - u_roughness (float): Fine grain covering the surface evenly (0 to 1)
|
|
23
|
+
* - u_roughnessSize (float): Scale of the roughness grain, needs roughness > 0 (0 to 1)
|
|
24
|
+
* - u_roughnessRows (float): Lines the roughness up into stripes, 0 = even scatter, 1 = laid-paper rows, needs roughness > 0 (0 to 1)
|
|
25
|
+
* - u_fiber (float): Curly thread-like noise covering the surface evenly (0 to 1)
|
|
26
|
+
* - u_fiberSize (float): Scale of the fiber noise, needs fiber > 0 (0 to 1)
|
|
27
|
+
* - u_folds (float): Straight vertical and horizontal fold lines producing ridges and valleys (0 to 1)
|
|
28
|
+
* - u_foldSizeX (float): Size of the vertical folds, needs folds > 0 (0 to 1)
|
|
29
|
+
* - u_foldSizeY (float): Size of the horizontal folds, needs folds > 0 (0 to 1)
|
|
30
|
+
* - u_foldOffsetX (float): Shifts the vertical folds across the surface, needs folds > 0 (0 to 1)
|
|
31
|
+
* - u_foldOffsetY (float): Shifts the horizontal folds across the surface, needs folds > 0 (0 to 1)
|
|
32
|
+
* - u_wrinkles (float): Crumple-like facets repeating across the surface (0 to 1)
|
|
33
|
+
* - u_wrinkleSize (float): Scale of the wrinkle facets, needs wrinkles > 0 (0 to 1)
|
|
34
|
+
* - u_crumples (float): A set of irregular folding lines (0 to 1)
|
|
35
|
+
* - u_crumpleCount (float): Number of facets in the crumple field, needs crumples > 0 (2 to 15)
|
|
36
|
+
* - u_drops (float): Visibility of the speckle pattern, darkens the image instead of coloring it (0 to 1)
|
|
25
37
|
* - u_noiseTexture (sampler2D): Pre-computed randomizer source texture
|
|
26
38
|
*
|
|
27
39
|
* Vertex shader outputs (used in fragment shader):
|
|
@@ -32,8 +44,6 @@ import { type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-si
|
|
|
32
44
|
* - u_pixelRatio (float): Device pixel ratio
|
|
33
45
|
* - u_originX (float): Reference point for positioning world width in the canvas (0 to 1)
|
|
34
46
|
* - u_originY (float): Reference point for positioning world height in the canvas (0 to 1)
|
|
35
|
-
* - u_worldWidth (float): Virtual width of the graphic before it's scaled to fit the canvas
|
|
36
|
-
* - u_worldHeight (float): Virtual height of the graphic before it's scaled to fit the canvas
|
|
37
47
|
* - u_fit (float): How to fit the rendered shader into the canvas dimensions (0 = none, 1 = contain, 2 = cover)
|
|
38
48
|
* - u_scale (float): Overall zoom level of the graphics (0.01 to 4)
|
|
39
49
|
* - u_rotation (float): Overall rotation angle of the graphics in degrees (0 to 360)
|
|
@@ -45,34 +55,55 @@ import { type ShaderSizingParams, type ShaderSizingUniforms } from '../shader-si
|
|
|
45
55
|
export declare const paperTextureFragmentShader: string;
|
|
46
56
|
export interface PaperTextureUniforms extends ShaderSizingUniforms {
|
|
47
57
|
u_image: HTMLImageElement | string | undefined;
|
|
48
|
-
|
|
49
|
-
u_colorFront: [number, number, number, number];
|
|
58
|
+
u_isImage: boolean;
|
|
50
59
|
u_colorBack: [number, number, number, number];
|
|
51
|
-
|
|
60
|
+
u_colorPaper: [number, number, number, number];
|
|
61
|
+
u_colorShadow: [number, number, number, number];
|
|
62
|
+
u_blending: number;
|
|
63
|
+
u_distortion: number;
|
|
64
|
+
u_clip: boolean;
|
|
65
|
+
u_angle: number;
|
|
66
|
+
u_seed: number;
|
|
52
67
|
u_roughness: number;
|
|
68
|
+
u_roughnessSize: number;
|
|
69
|
+
u_roughnessRows: number;
|
|
53
70
|
u_fiber: number;
|
|
54
71
|
u_fiberSize: number;
|
|
55
|
-
u_crumples: number;
|
|
56
|
-
u_foldCount: number;
|
|
57
72
|
u_folds: number;
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
u_foldSizeX: number;
|
|
74
|
+
u_foldSizeY: number;
|
|
75
|
+
u_foldOffsetX: number;
|
|
76
|
+
u_foldOffsetY: number;
|
|
77
|
+
u_wrinkles: number;
|
|
78
|
+
u_wrinkleSize: number;
|
|
79
|
+
u_crumples: number;
|
|
80
|
+
u_crumpleCount: number;
|
|
60
81
|
u_drops: number;
|
|
61
|
-
|
|
82
|
+
u_noiseTexture?: HTMLImageElement;
|
|
62
83
|
}
|
|
63
84
|
export interface PaperTextureParams extends ShaderSizingParams, ShaderMotionParams {
|
|
64
85
|
image?: HTMLImageElement | string;
|
|
65
|
-
colorFront?: string;
|
|
66
86
|
colorBack?: string;
|
|
67
|
-
|
|
87
|
+
colorPaper?: string;
|
|
88
|
+
colorShadow?: string;
|
|
89
|
+
blending?: number;
|
|
90
|
+
distortion?: number;
|
|
91
|
+
clip?: boolean;
|
|
92
|
+
angle?: number;
|
|
93
|
+
seed?: number;
|
|
68
94
|
roughness?: number;
|
|
95
|
+
roughnessSize?: number;
|
|
96
|
+
roughnessRows?: number;
|
|
69
97
|
fiber?: number;
|
|
70
98
|
fiberSize?: number;
|
|
71
|
-
crumples?: number;
|
|
72
|
-
foldCount?: number;
|
|
73
99
|
folds?: number;
|
|
74
|
-
|
|
75
|
-
|
|
100
|
+
foldSizeX?: number;
|
|
101
|
+
foldSizeY?: number;
|
|
102
|
+
foldOffsetX?: number;
|
|
103
|
+
foldOffsetY?: number;
|
|
104
|
+
wrinkles?: number;
|
|
105
|
+
wrinkleSize?: number;
|
|
106
|
+
crumples?: number;
|
|
107
|
+
crumpleCount?: number;
|
|
76
108
|
drops?: number;
|
|
77
|
-
seed?: number;
|
|
78
109
|
}
|