@paper-design/shaders-react 0.0.0-canary.df6790b → 0.0.0-canary.fd43be6
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/LICENSE +201 -21
- package/NOTICE +5 -0
- package/dist/color-props-are-equal.js +3 -0
- package/dist/color-props-are-equal.js.map +2 -2
- package/dist/html-in-canvas.d.ts +21 -0
- package/dist/html-in-canvas.js +93 -0
- package/dist/html-in-canvas.js.map +7 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +2 -2
- package/dist/set-min-image-size.d.ts +5 -0
- package/dist/set-min-image-size.js +19 -0
- package/dist/set-min-image-size.js.map +7 -0
- package/dist/shader-mount.d.ts +13 -1
- package/dist/shader-mount.js +43 -23
- package/dist/shader-mount.js.map +2 -2
- package/dist/shaders/fluted-glass.d.ts +1 -1
- package/dist/shaders/fluted-glass.js +82 -30
- package/dist/shaders/fluted-glass.js.map +2 -2
- package/dist/shaders/gem-smoke.d.ts +16 -0
- package/dist/shaders/gem-smoke.js +208 -0
- package/dist/shaders/gem-smoke.js.map +7 -0
- package/dist/shaders/halftone-cmyk.d.ts +12 -0
- package/dist/shaders/halftone-cmyk.js +237 -0
- package/dist/shaders/halftone-cmyk.js.map +7 -0
- package/dist/shaders/halftone-dots.d.ts +12 -0
- package/dist/shaders/halftone-dots.js +178 -0
- package/dist/shaders/halftone-dots.js.map +7 -0
- package/dist/shaders/heatmap.js +11 -1
- package/dist/shaders/heatmap.js.map +2 -2
- package/dist/shaders/image-dithering.js +14 -4
- package/dist/shaders/image-dithering.js.map +2 -2
- package/dist/shaders/lens-distortion.d.ts +12 -0
- package/dist/shaders/lens-distortion.js +232 -0
- package/dist/shaders/lens-distortion.js.map +7 -0
- package/dist/shaders/liquid-metal.js +2 -1
- package/dist/shaders/liquid-metal.js.map +2 -2
- package/dist/shaders/paper-texture.d.ts +4 -8
- package/dist/shaders/paper-texture.js +152 -91
- package/dist/shaders/paper-texture.js.map +2 -2
- package/dist/shaders/pulsing-border.js +1 -1
- package/dist/shaders/pulsing-border.js.map +1 -1
- package/dist/shaders/static-radial-gradient.js +3 -3
- package/dist/shaders/static-radial-gradient.js.map +1 -1
- package/dist/shaders/water.js +15 -4
- package/dist/shaders/water.js.map +2 -2
- package/package.json +6 -4
package/dist/shader-mount.js
CHANGED
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
import { useEffect, useRef, forwardRef, useState } from "react";
|
|
8
8
|
import {
|
|
9
9
|
ShaderMount as ShaderMountVanilla,
|
|
10
|
-
|
|
10
|
+
emptyPixel
|
|
11
11
|
} from "@paper-design/shaders";
|
|
12
12
|
import { useMergeRefs } from "./use-merge-refs.js";
|
|
13
|
+
import { setMinImageSize } from "./set-min-image-size.js";
|
|
14
|
+
import { useHtmlChildren } from "./html-in-canvas.js";
|
|
13
15
|
import { jsx } from "react/jsx-runtime";
|
|
14
16
|
async function processUniforms(uniformsProp) {
|
|
15
17
|
const processedUniforms = {};
|
|
@@ -34,28 +36,32 @@ async function processUniforms(uniformsProp) {
|
|
|
34
36
|
};
|
|
35
37
|
Object.entries(uniformsProp).forEach(([key, value]) => {
|
|
36
38
|
if (typeof value === "string") {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
if (!isValidUrl(value)) {
|
|
42
|
-
console.warn(`Uniform "${key}" has invalid URL "${value}". Skipping image loading.`);
|
|
39
|
+
const url = value || emptyPixel;
|
|
40
|
+
if (!isValidUrl(url)) {
|
|
41
|
+
console.warn(`Uniform "${key}" has invalid URL "${url}". Skipping image loading.`);
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
const imagePromise = new Promise((resolve, reject) => {
|
|
46
45
|
const img = new Image();
|
|
47
|
-
if (isExternalUrl(
|
|
46
|
+
if (isExternalUrl(url)) {
|
|
48
47
|
img.crossOrigin = "anonymous";
|
|
49
48
|
}
|
|
50
49
|
img.onload = () => {
|
|
50
|
+
setMinImageSize(img);
|
|
51
51
|
processedUniforms[key] = img;
|
|
52
52
|
resolve();
|
|
53
53
|
};
|
|
54
54
|
img.onerror = () => {
|
|
55
|
-
console.error(`Could not set uniforms. Failed to load image at ${
|
|
55
|
+
console.error(`Could not set uniforms. Failed to load image at ${url}`);
|
|
56
56
|
reject();
|
|
57
57
|
};
|
|
58
|
-
img.src =
|
|
58
|
+
img.src = url;
|
|
59
|
+
});
|
|
60
|
+
imageLoadPromises.push(imagePromise);
|
|
61
|
+
} else if (value instanceof HTMLImageElement) {
|
|
62
|
+
const imagePromise = value.decode().then(() => {
|
|
63
|
+
setMinImageSize(value);
|
|
64
|
+
processedUniforms[key] = value;
|
|
59
65
|
});
|
|
60
66
|
imageLoadPromises.push(imagePromise);
|
|
61
67
|
} else {
|
|
@@ -76,6 +82,11 @@ const ShaderMount = forwardRef(
|
|
|
76
82
|
height,
|
|
77
83
|
minPixelRatio,
|
|
78
84
|
maxPixelCount,
|
|
85
|
+
mipmaps,
|
|
86
|
+
acceptsHtmlChildren = false,
|
|
87
|
+
layoutProps,
|
|
88
|
+
sizeToContent,
|
|
89
|
+
children,
|
|
79
90
|
style,
|
|
80
91
|
...divProps
|
|
81
92
|
}, forwardedRef) {
|
|
@@ -83,10 +94,19 @@ const ShaderMount = forwardRef(
|
|
|
83
94
|
const divRef = useRef(null);
|
|
84
95
|
const shaderMountRef = useRef(null);
|
|
85
96
|
const webGlContextAttributesRef = useRef(webGlContextAttributes);
|
|
97
|
+
const { hasHtmlChildren, addHtmlUniform, renderedChildren, sizeStyle } = useHtmlChildren(
|
|
98
|
+
acceptsHtmlChildren,
|
|
99
|
+
children,
|
|
100
|
+
layoutProps,
|
|
101
|
+
sizeToContent,
|
|
102
|
+
divRef
|
|
103
|
+
);
|
|
104
|
+
const getUniforms = () => addHtmlUniform(uniformsProp);
|
|
86
105
|
useEffect(() => {
|
|
106
|
+
let isStale = false;
|
|
87
107
|
const initShader = async () => {
|
|
88
|
-
const uniforms = await processUniforms(
|
|
89
|
-
if (divRef.current && !shaderMountRef.current) {
|
|
108
|
+
const uniforms = await processUniforms(getUniforms());
|
|
109
|
+
if (!isStale && divRef.current && !shaderMountRef.current) {
|
|
90
110
|
shaderMountRef.current = new ShaderMountVanilla(
|
|
91
111
|
divRef.current,
|
|
92
112
|
fragmentShader,
|
|
@@ -95,21 +115,23 @@ const ShaderMount = forwardRef(
|
|
|
95
115
|
speed,
|
|
96
116
|
frame,
|
|
97
117
|
minPixelRatio,
|
|
98
|
-
maxPixelCount
|
|
118
|
+
maxPixelCount,
|
|
119
|
+
mipmaps
|
|
99
120
|
);
|
|
100
121
|
setIsInitialized(true);
|
|
101
122
|
}
|
|
102
123
|
};
|
|
103
124
|
initShader();
|
|
104
125
|
return () => {
|
|
126
|
+
isStale = true;
|
|
105
127
|
shaderMountRef.current?.dispose();
|
|
106
128
|
shaderMountRef.current = null;
|
|
107
129
|
};
|
|
108
|
-
}, [fragmentShader]);
|
|
130
|
+
}, [fragmentShader, hasHtmlChildren]);
|
|
109
131
|
useEffect(() => {
|
|
110
132
|
let isStale = false;
|
|
111
133
|
const updateUniforms = async () => {
|
|
112
|
-
const uniforms = await processUniforms(
|
|
134
|
+
const uniforms = await processUniforms(getUniforms());
|
|
113
135
|
if (!isStale) {
|
|
114
136
|
shaderMountRef.current?.setUniforms(uniforms);
|
|
115
137
|
}
|
|
@@ -132,14 +154,12 @@ const ShaderMount = forwardRef(
|
|
|
132
154
|
shaderMountRef.current?.setFrame(frame);
|
|
133
155
|
}, [frame, isInitialized]);
|
|
134
156
|
const mergedRef = useMergeRefs([divRef, forwardedRef]);
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
);
|
|
157
|
+
const shaderStyle = width !== void 0 || height !== void 0 ? {
|
|
158
|
+
width: typeof width === "string" && isNaN(+width) === false ? +width : width,
|
|
159
|
+
height: typeof height === "string" && isNaN(+height) === false ? +height : height,
|
|
160
|
+
...style
|
|
161
|
+
} : style;
|
|
162
|
+
return /* @__PURE__ */ jsx("div", { ref: mergedRef, style: sizeStyle ? { ...shaderStyle, ...sizeStyle } : shaderStyle, ...divProps, children: renderedChildren });
|
|
143
163
|
}
|
|
144
164
|
);
|
|
145
165
|
ShaderMount.displayName = "ShaderMount";
|
package/dist/shader-mount.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/shader-mount.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport { useEffect, useRef, forwardRef, useState } from 'react';\nimport {\n ShaderMount as ShaderMountVanilla,\n
|
|
5
|
-
"mappings": ";;;;;;AAEA,SAAS,WAAW,QAAQ,YAAY,gBAAgB;AACxD;AAAA,EACE,eAAe;AAAA,EACf;AAAA,OAIK;AACP,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport { useEffect, useRef, forwardRef, useState } from 'react';\nimport {\n ShaderMount as ShaderMountVanilla,\n emptyPixel,\n type PaperShaderElement,\n type ShaderMotionParams,\n type ShaderMountUniforms,\n} from '@paper-design/shaders';\nimport { useMergeRefs } from './use-merge-refs.js';\nimport { setMinImageSize } from './set-min-image-size.js';\nimport { useHtmlChildren, type ShaderLayoutProps, type ShaderSizeToContent } from './html-in-canvas.js';\n\n/**\n * React Shader Mount can also accept strings as uniform values, which will assumed to be URLs and loaded as images\n *\n * We accept undefined as a convenience for server rendering, when some things may be undefined\n * We just skip setting the uniform if it's undefined. This allows the shader mount to still take up space during server rendering\n */\ninterface ShaderMountUniformsReact {\n [key: string]: string | boolean | number | number[] | number[][] | HTMLImageElement | HTMLElement | undefined;\n}\n\nexport interface ShaderMountProps extends Omit<React.ComponentProps<'div'>, 'color' | 'ref'>, ShaderMotionParams {\n ref?: React.Ref<PaperShaderElement>;\n fragmentShader: string;\n uniforms: ShaderMountUniformsReact;\n mipmaps?: string[];\n minPixelRatio?: number;\n maxPixelCount?: number;\n webGlContextAttributes?: WebGLContextAttributes;\n /** Set by shaders that can draw their children into u_image (experimental) */\n acceptsHtmlChildren?: boolean;\n /** Props of the element that holds the children and is drawn with them: layout, padding, background, border */\n layoutProps?: ShaderLayoutProps;\n /** Size the shader to its children on these axes instead of its own width and height styles */\n sizeToContent?: ShaderSizeToContent;\n\n /** Inline CSS width style */\n width?: string | number;\n /** Inline CSS height style */\n height?: string | number;\n}\n\nexport interface ShaderComponentProps extends Omit<React.ComponentProps<'div'>, 'color' | 'ref'> {\n ref?: React.Ref<PaperShaderElement>;\n minPixelRatio?: number;\n maxPixelCount?: number;\n webGlContextAttributes?: WebGLContextAttributes;\n /** Props of the element that holds the children and is drawn with them, for shaders that accept HTML children */\n layoutProps?: ShaderLayoutProps;\n /** Size the shader to its children on these axes, for shaders that accept HTML children */\n sizeToContent?: ShaderSizeToContent;\n\n /** Inline CSS width style */\n width?: string | number;\n /** Inline CSS height style */\n height?: string | number;\n}\n\n/** Parse the provided uniforms, turning URL strings into loaded images */\nasync function processUniforms(uniformsProp: ShaderMountUniformsReact): Promise<ShaderMountUniforms> {\n const processedUniforms = {} as ShaderMountUniforms;\n const imageLoadPromises: Promise<void>[] = [];\n\n const isValidUrl = (url: string): boolean => {\n try {\n // Handle absolute paths\n if (url.startsWith('/')) return true;\n // Check if it's a valid URL\n new URL(url);\n return true;\n } catch {\n return false;\n }\n };\n\n const isExternalUrl = (url: string): boolean => {\n try {\n if (url.startsWith('/')) return false;\n const urlObject = new URL(url, window.location.origin);\n return urlObject.origin !== window.location.origin;\n } catch {\n return false;\n }\n };\n\n Object.entries(uniformsProp).forEach(([key, value]) => {\n if (typeof value === 'string') {\n // Use a transparent pixel for empty strings\n const url = value || emptyPixel;\n\n // Make sure the provided string is a valid URL or just skip trying to set this uniform entirely\n if (!isValidUrl(url)) {\n console.warn(`Uniform \"${key}\" has invalid URL \"${url}\". Skipping image loading.`);\n return;\n }\n\n const imagePromise = new Promise<void>((resolve, reject) => {\n const img = new Image();\n if (isExternalUrl(url)) {\n img.crossOrigin = 'anonymous';\n }\n img.onload = () => {\n setMinImageSize(img);\n processedUniforms[key] = img;\n resolve();\n };\n img.onerror = () => {\n console.error(`Could not set uniforms. Failed to load image at ${url}`);\n reject();\n };\n img.src = url;\n });\n\n imageLoadPromises.push(imagePromise);\n } else if (value instanceof HTMLImageElement) {\n const imagePromise = value.decode().then(() => {\n setMinImageSize(value);\n processedUniforms[key] = value;\n });\n imageLoadPromises.push(imagePromise);\n } else {\n processedUniforms[key] = value;\n }\n });\n\n await Promise.all(imageLoadPromises);\n return processedUniforms;\n}\n\n/**\n * A React component that mounts a shader and updates its uniforms as the component's props change\n * If you pass a string as a uniform value, it will be assumed to be a URL and attempted to be loaded as an image\n */\nexport const ShaderMount: React.FC<ShaderMountProps> = forwardRef<PaperShaderElement, ShaderMountProps>(\n function ShaderMountImpl(\n {\n fragmentShader,\n uniforms: uniformsProp,\n webGlContextAttributes,\n speed = 0,\n frame = 0,\n width,\n height,\n minPixelRatio,\n maxPixelCount,\n mipmaps,\n acceptsHtmlChildren = false,\n layoutProps,\n sizeToContent,\n children,\n style,\n ...divProps\n },\n forwardedRef\n ) {\n const [isInitialized, setIsInitialized] = useState(false);\n const divRef = useRef<PaperShaderElement>(null);\n const shaderMountRef: React.RefObject<ShaderMountVanilla | null> = useRef<ShaderMountVanilla>(null);\n const webGlContextAttributesRef = useRef(webGlContextAttributes);\n const { hasHtmlChildren, addHtmlUniform, renderedChildren, sizeStyle } = useHtmlChildren(\n acceptsHtmlChildren,\n children,\n layoutProps,\n sizeToContent,\n divRef\n );\n\n const getUniforms = (): ShaderMountUniformsReact => addHtmlUniform(uniformsProp);\n\n // Initialize the ShaderMountVanilla\n useEffect(() => {\n let isStale = false;\n\n const initShader = async () => {\n const uniforms = await processUniforms(getUniforms());\n\n if (!isStale && divRef.current && !shaderMountRef.current) {\n shaderMountRef.current = new ShaderMountVanilla(\n divRef.current,\n fragmentShader,\n uniforms,\n webGlContextAttributesRef.current,\n speed,\n frame,\n minPixelRatio,\n maxPixelCount,\n mipmaps\n );\n\n setIsInitialized(true);\n }\n };\n\n initShader();\n\n return () => {\n isStale = true;\n shaderMountRef.current?.dispose();\n shaderMountRef.current = null;\n };\n }, [fragmentShader, hasHtmlChildren]);\n\n // Uniforms\n useEffect(() => {\n let isStale = false;\n\n const updateUniforms = async () => {\n const uniforms = await processUniforms(getUniforms());\n\n if (!isStale) {\n // We only use the freshest uniforms otherwise we can get into race conditions\n // if some uniforms (images!) take longer to load in subsequent effect runs.\n shaderMountRef.current?.setUniforms(uniforms);\n }\n };\n\n updateUniforms();\n\n return () => {\n isStale = true;\n };\n }, [uniformsProp, isInitialized]);\n\n // Speed\n useEffect(() => {\n shaderMountRef.current?.setSpeed(speed);\n }, [speed, isInitialized]);\n\n // Max Pixel Count\n useEffect(() => {\n shaderMountRef.current?.setMaxPixelCount(maxPixelCount);\n }, [maxPixelCount, isInitialized]);\n\n // Min Pixel Ratio\n useEffect(() => {\n shaderMountRef.current?.setMinPixelRatio(minPixelRatio);\n }, [minPixelRatio, isInitialized]);\n\n // Frame\n useEffect(() => {\n shaderMountRef.current?.setFrame(frame);\n }, [frame, isInitialized]);\n\n const mergedRef = useMergeRefs([divRef, forwardedRef]) as unknown as React.RefObject<HTMLDivElement>;\n const shaderStyle =\n width !== undefined || height !== undefined\n ? {\n width: typeof width === 'string' && isNaN(+width) === false ? +width : width,\n height: typeof height === 'string' && isNaN(+height) === false ? +height : height,\n ...style,\n }\n : style;\n return (\n <div ref={mergedRef} style={sizeStyle ? { ...shaderStyle, ...sizeStyle } : shaderStyle} {...divProps}>\n {renderedChildren}\n </div>\n );\n }\n);\n\nShaderMount.displayName = 'ShaderMount';\n"],
|
|
5
|
+
"mappings": ";;;;;;AAEA,SAAS,WAAW,QAAQ,YAAY,gBAAgB;AACxD;AAAA,EACE,eAAe;AAAA,EACf;AAAA,OAIK;AACP,SAAS,oBAAoB;AAC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Props extends ShaderComponentProps, FlutedGlassParam
|
|
|
7
7
|
type FlutedGlassPreset = ImageShaderPreset<FlutedGlassParams>;
|
|
8
8
|
export declare const defaultPreset: FlutedGlassPreset;
|
|
9
9
|
export declare const wavesPreset: FlutedGlassPreset;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const abstractPreset: FlutedGlassPreset;
|
|
11
11
|
export declare const foldsPreset: FlutedGlassPreset;
|
|
12
12
|
export declare const flutedGlassPresets: FlutedGlassPreset[];
|
|
13
13
|
export declare const FlutedGlass: React.FC<FlutedGlassProps>;
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
ShaderFitOptions,
|
|
11
11
|
defaultObjectSizing,
|
|
12
12
|
GlassDistortionShapes,
|
|
13
|
-
GlassGridShapes
|
|
13
|
+
GlassGridShapes,
|
|
14
|
+
getShaderColorFromString
|
|
14
15
|
} from "@paper-design/shaders";
|
|
15
16
|
import { jsx } from "react/jsx-runtime";
|
|
16
17
|
const defaultPreset = {
|
|
@@ -20,19 +21,27 @@ const defaultPreset = {
|
|
|
20
21
|
fit: "cover",
|
|
21
22
|
speed: 0,
|
|
22
23
|
frame: 0,
|
|
23
|
-
|
|
24
|
+
colorBack: "#00000000",
|
|
25
|
+
colorShadow: "#000000",
|
|
26
|
+
colorHighlight: "#ffffff",
|
|
27
|
+
shadows: 0.25,
|
|
28
|
+
size: 0.5,
|
|
24
29
|
angle: 0,
|
|
25
|
-
distortionShape: "
|
|
30
|
+
distortionShape: "prism",
|
|
31
|
+
highlights: 0.1,
|
|
26
32
|
shape: "lines",
|
|
27
33
|
distortion: 0.5,
|
|
28
34
|
shift: 0,
|
|
29
|
-
blur:
|
|
30
|
-
edges: 0,
|
|
35
|
+
blur: 0,
|
|
36
|
+
edges: 0.25,
|
|
37
|
+
stretch: 0,
|
|
31
38
|
margin: 0,
|
|
32
39
|
marginLeft: 0,
|
|
33
40
|
marginRight: 0,
|
|
34
41
|
marginTop: 0,
|
|
35
|
-
marginBottom: 0
|
|
42
|
+
marginBottom: 0,
|
|
43
|
+
grainMixer: 0,
|
|
44
|
+
grainOverlay: 0
|
|
36
45
|
}
|
|
37
46
|
};
|
|
38
47
|
const wavesPreset = {
|
|
@@ -40,44 +49,61 @@ const wavesPreset = {
|
|
|
40
49
|
params: {
|
|
41
50
|
...defaultObjectSizing,
|
|
42
51
|
fit: "cover",
|
|
52
|
+
scale: 1.2,
|
|
43
53
|
speed: 0,
|
|
44
54
|
frame: 0,
|
|
45
|
-
|
|
55
|
+
colorBack: "#00000000",
|
|
56
|
+
colorShadow: "#000000",
|
|
57
|
+
colorHighlight: "#ffffff",
|
|
58
|
+
shadows: 0,
|
|
59
|
+
size: 0.9,
|
|
46
60
|
angle: 0,
|
|
47
61
|
distortionShape: "contour",
|
|
62
|
+
highlights: 0,
|
|
48
63
|
shape: "wave",
|
|
49
|
-
distortion: 0.
|
|
64
|
+
distortion: 0.5,
|
|
50
65
|
shift: 0,
|
|
51
|
-
blur: 0,
|
|
52
|
-
edges: 0,
|
|
66
|
+
blur: 0.1,
|
|
67
|
+
edges: 0.5,
|
|
68
|
+
stretch: 1,
|
|
53
69
|
margin: 0,
|
|
54
70
|
marginLeft: 0,
|
|
55
71
|
marginRight: 0,
|
|
56
72
|
marginTop: 0,
|
|
57
|
-
marginBottom: 0
|
|
73
|
+
marginBottom: 0,
|
|
74
|
+
grainMixer: 0,
|
|
75
|
+
grainOverlay: 0.05
|
|
58
76
|
}
|
|
59
77
|
};
|
|
60
|
-
const
|
|
61
|
-
name: "
|
|
78
|
+
const abstractPreset = {
|
|
79
|
+
name: "Abstract",
|
|
62
80
|
params: {
|
|
63
81
|
...defaultObjectSizing,
|
|
64
82
|
fit: "cover",
|
|
65
83
|
scale: 4,
|
|
66
84
|
speed: 0,
|
|
67
85
|
frame: 0,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
colorBack: "#00000000",
|
|
87
|
+
colorShadow: "#000000",
|
|
88
|
+
colorHighlight: "#ffffff",
|
|
89
|
+
shadows: 0,
|
|
90
|
+
size: 0.7,
|
|
91
|
+
angle: 30,
|
|
92
|
+
distortionShape: "flat",
|
|
93
|
+
highlights: 0,
|
|
71
94
|
shape: "linesIrregular",
|
|
72
95
|
distortion: 1,
|
|
73
96
|
shift: 0,
|
|
74
|
-
blur:
|
|
75
|
-
edges:
|
|
97
|
+
blur: 1,
|
|
98
|
+
edges: 0.5,
|
|
99
|
+
stretch: 1,
|
|
76
100
|
margin: 0,
|
|
77
101
|
marginLeft: 0,
|
|
78
102
|
marginRight: 0,
|
|
79
103
|
marginTop: 0,
|
|
80
|
-
marginBottom: 0
|
|
104
|
+
marginBottom: 0,
|
|
105
|
+
grainMixer: 0.1,
|
|
106
|
+
grainOverlay: 0.1
|
|
81
107
|
}
|
|
82
108
|
};
|
|
83
109
|
const foldsPreset = {
|
|
@@ -87,39 +113,55 @@ const foldsPreset = {
|
|
|
87
113
|
fit: "cover",
|
|
88
114
|
speed: 0,
|
|
89
115
|
frame: 0,
|
|
90
|
-
|
|
116
|
+
colorBack: "#00000000",
|
|
117
|
+
colorShadow: "#000000",
|
|
118
|
+
colorHighlight: "#ffffff",
|
|
119
|
+
shadows: 0.4,
|
|
120
|
+
size: 0.4,
|
|
91
121
|
angle: 0,
|
|
92
122
|
distortionShape: "cascade",
|
|
123
|
+
highlights: 0,
|
|
93
124
|
shape: "lines",
|
|
94
125
|
distortion: 0.75,
|
|
95
126
|
shift: 0,
|
|
96
|
-
blur: 0,
|
|
97
|
-
edges: 0,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
blur: 0.25,
|
|
128
|
+
edges: 0.5,
|
|
129
|
+
stretch: 0,
|
|
130
|
+
margin: 0.1,
|
|
131
|
+
marginLeft: 0.1,
|
|
132
|
+
marginRight: 0.1,
|
|
133
|
+
marginTop: 0.1,
|
|
134
|
+
marginBottom: 0.1,
|
|
135
|
+
grainMixer: 0,
|
|
136
|
+
grainOverlay: 0
|
|
103
137
|
}
|
|
104
138
|
};
|
|
105
|
-
const flutedGlassPresets = [defaultPreset,
|
|
139
|
+
const flutedGlassPresets = [defaultPreset, abstractPreset, wavesPreset, foldsPreset];
|
|
106
140
|
const FlutedGlass = memo(function FlutedGlassImpl({
|
|
107
141
|
// Own props
|
|
108
142
|
speed = defaultPreset.params.speed,
|
|
109
143
|
frame = defaultPreset.params.frame,
|
|
144
|
+
colorBack = defaultPreset.params.colorBack,
|
|
145
|
+
colorShadow = defaultPreset.params.colorShadow,
|
|
146
|
+
colorHighlight = defaultPreset.params.colorHighlight,
|
|
110
147
|
image = "",
|
|
148
|
+
shadows = defaultPreset.params.shadows,
|
|
111
149
|
angle = defaultPreset.params.angle,
|
|
112
150
|
distortion = defaultPreset.params.distortion,
|
|
113
151
|
distortionShape = defaultPreset.params.distortionShape,
|
|
152
|
+
highlights = defaultPreset.params.highlights,
|
|
114
153
|
shape = defaultPreset.params.shape,
|
|
115
154
|
shift = defaultPreset.params.shift,
|
|
116
155
|
blur = defaultPreset.params.blur,
|
|
156
|
+
edges = defaultPreset.params.edges,
|
|
117
157
|
margin,
|
|
118
158
|
marginLeft = margin ?? defaultPreset.params.marginLeft,
|
|
119
159
|
marginRight = margin ?? defaultPreset.params.marginRight,
|
|
120
160
|
marginTop = margin ?? defaultPreset.params.marginTop,
|
|
121
161
|
marginBottom = margin ?? defaultPreset.params.marginBottom,
|
|
122
|
-
|
|
162
|
+
grainMixer = defaultPreset.params.grainMixer,
|
|
163
|
+
grainOverlay = defaultPreset.params.grainOverlay,
|
|
164
|
+
stretch = defaultPreset.params.stretch,
|
|
123
165
|
// integer `count` was deprecated in favor of the normalized `size` param
|
|
124
166
|
count,
|
|
125
167
|
size = count === void 0 ? defaultPreset.params.size : Math.pow(1 / (count * 1.6), 1 / 6) / 0.7 - 0.5,
|
|
@@ -138,18 +180,26 @@ const FlutedGlass = memo(function FlutedGlassImpl({
|
|
|
138
180
|
const uniforms = {
|
|
139
181
|
// Own uniforms
|
|
140
182
|
u_image: image,
|
|
183
|
+
u_colorBack: getShaderColorFromString(colorBack),
|
|
184
|
+
u_colorShadow: getShaderColorFromString(colorShadow),
|
|
185
|
+
u_colorHighlight: getShaderColorFromString(colorHighlight),
|
|
186
|
+
u_shadows: shadows,
|
|
141
187
|
u_size: size,
|
|
142
188
|
u_angle: angle,
|
|
143
189
|
u_distortion: distortion,
|
|
144
190
|
u_shift: shift,
|
|
145
191
|
u_blur: blur,
|
|
146
192
|
u_edges: edges,
|
|
193
|
+
u_stretch: stretch,
|
|
147
194
|
u_distortionShape: GlassDistortionShapes[distortionShape],
|
|
195
|
+
u_highlights: highlights,
|
|
148
196
|
u_shape: GlassGridShapes[shape],
|
|
149
197
|
u_marginLeft: marginLeft,
|
|
150
198
|
u_marginRight: marginRight,
|
|
151
199
|
u_marginTop: marginTop,
|
|
152
200
|
u_marginBottom: marginBottom,
|
|
201
|
+
u_grainMixer: grainMixer,
|
|
202
|
+
u_grainOverlay: grainOverlay,
|
|
153
203
|
// Sizing uniforms
|
|
154
204
|
u_fit: ShaderFitOptions[fit],
|
|
155
205
|
u_scale: scale,
|
|
@@ -168,16 +218,18 @@ const FlutedGlass = memo(function FlutedGlassImpl({
|
|
|
168
218
|
speed,
|
|
169
219
|
frame,
|
|
170
220
|
fragmentShader: flutedGlassFragmentShader,
|
|
221
|
+
acceptsHtmlChildren: true,
|
|
222
|
+
mipmaps: ["u_image"],
|
|
171
223
|
uniforms
|
|
172
224
|
}
|
|
173
225
|
);
|
|
174
226
|
});
|
|
175
227
|
export {
|
|
176
228
|
FlutedGlass,
|
|
229
|
+
abstractPreset,
|
|
177
230
|
defaultPreset,
|
|
178
231
|
flutedGlassPresets,
|
|
179
232
|
foldsPreset,
|
|
180
|
-
irregularPreset,
|
|
181
233
|
wavesPreset
|
|
182
234
|
};
|
|
183
235
|
//# sourceMappingURL=fluted-glass.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shaders/fluted-glass.tsx"],
|
|
4
|
-
"sourcesContent": ["import { memo } from 'react';\nimport { ShaderMount, type ShaderComponentProps } from '../shader-mount.js';\nimport {\n flutedGlassFragmentShader,\n ShaderFitOptions,\n type FlutedGlassUniforms,\n type FlutedGlassParams,\n defaultObjectSizing,\n GlassDistortionShapes,\n GlassGridShapes,\n type ImageShaderPreset,\n} from '@paper-design/shaders';\n\nexport interface FlutedGlassProps extends ShaderComponentProps, FlutedGlassParams {\n /** @deprecated use `size` instead */\n count?: number;\n}\n\ntype FlutedGlassPreset = ImageShaderPreset<FlutedGlassParams>;\n\nexport const defaultPreset: FlutedGlassPreset = {\n name: 'Default',\n params: {\n ...defaultObjectSizing,\n fit: 'cover',\n speed: 0,\n frame: 0,\n size: 0.
|
|
5
|
-
"mappings": ";;;;;AAAA,SAAS,YAAY;AACrB,SAAS,mBAA8C;AACvD;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { memo } from 'react';\nimport { ShaderMount, type ShaderComponentProps } from '../shader-mount.js';\nimport {\n flutedGlassFragmentShader,\n ShaderFitOptions,\n type FlutedGlassUniforms,\n type FlutedGlassParams,\n defaultObjectSizing,\n GlassDistortionShapes,\n GlassGridShapes,\n type ImageShaderPreset,\n getShaderColorFromString,\n} from '@paper-design/shaders';\n\nexport interface FlutedGlassProps extends ShaderComponentProps, FlutedGlassParams {\n /** @deprecated use `size` instead */\n count?: number;\n}\n\ntype FlutedGlassPreset = ImageShaderPreset<FlutedGlassParams>;\n\nexport const defaultPreset: FlutedGlassPreset = {\n name: 'Default',\n params: {\n ...defaultObjectSizing,\n fit: 'cover',\n speed: 0,\n frame: 0,\n colorBack: '#00000000',\n colorShadow: '#000000',\n colorHighlight: '#ffffff',\n shadows: 0.25,\n size: 0.5,\n angle: 0,\n distortionShape: 'prism',\n highlights: 0.1,\n shape: 'lines',\n distortion: 0.5,\n shift: 0,\n blur: 0,\n edges: 0.25,\n stretch: 0,\n margin: 0,\n marginLeft: 0,\n marginRight: 0,\n marginTop: 0,\n marginBottom: 0,\n grainMixer: 0,\n grainOverlay: 0,\n },\n};\n\nexport const wavesPreset: FlutedGlassPreset = {\n name: 'Waves',\n params: {\n ...defaultObjectSizing,\n fit: 'cover',\n scale: 1.2,\n speed: 0,\n frame: 0,\n colorBack: '#00000000',\n colorShadow: '#000000',\n colorHighlight: '#ffffff',\n shadows: 0,\n size: 0.9,\n angle: 0,\n distortionShape: 'contour',\n highlights: 0,\n shape: 'wave',\n distortion: 0.5,\n shift: 0,\n blur: 0.1,\n edges: 0.5,\n stretch: 1,\n margin: 0,\n marginLeft: 0,\n marginRight: 0,\n marginTop: 0,\n marginBottom: 0,\n grainMixer: 0,\n grainOverlay: 0.05,\n },\n};\n\nexport const abstractPreset: FlutedGlassPreset = {\n name: 'Abstract',\n params: {\n ...defaultObjectSizing,\n fit: 'cover',\n scale: 4,\n speed: 0,\n frame: 0,\n colorBack: '#00000000',\n colorShadow: '#000000',\n colorHighlight: '#ffffff',\n shadows: 0,\n size: 0.7,\n angle: 30,\n distortionShape: 'flat',\n highlights: 0,\n shape: 'linesIrregular',\n distortion: 1,\n shift: 0,\n blur: 1,\n edges: 0.5,\n stretch: 1,\n margin: 0,\n marginLeft: 0,\n marginRight: 0,\n marginTop: 0,\n marginBottom: 0,\n grainMixer: 0.1,\n grainOverlay: 0.1,\n },\n};\n\nexport const foldsPreset: FlutedGlassPreset = {\n name: 'Folds',\n params: {\n ...defaultObjectSizing,\n fit: 'cover',\n speed: 0,\n frame: 0,\n colorBack: '#00000000',\n colorShadow: '#000000',\n colorHighlight: '#ffffff',\n shadows: 0.4,\n size: 0.4,\n angle: 0,\n distortionShape: 'cascade',\n highlights: 0,\n shape: 'lines',\n distortion: 0.75,\n shift: 0,\n blur: 0.25,\n edges: 0.5,\n stretch: 0,\n margin: 0.1,\n marginLeft: 0.1,\n marginRight: 0.1,\n marginTop: 0.1,\n marginBottom: 0.1,\n grainMixer: 0,\n grainOverlay: 0,\n },\n};\n\nexport const flutedGlassPresets: FlutedGlassPreset[] = [defaultPreset, abstractPreset, wavesPreset, foldsPreset];\n\nexport const FlutedGlass: React.FC<FlutedGlassProps> = memo(function FlutedGlassImpl({\n // Own props\n speed = defaultPreset.params.speed,\n frame = defaultPreset.params.frame,\n colorBack = defaultPreset.params.colorBack,\n colorShadow = defaultPreset.params.colorShadow,\n colorHighlight = defaultPreset.params.colorHighlight,\n image = '',\n shadows = defaultPreset.params.shadows,\n angle = defaultPreset.params.angle,\n distortion = defaultPreset.params.distortion,\n distortionShape = defaultPreset.params.distortionShape,\n highlights = defaultPreset.params.highlights,\n shape = defaultPreset.params.shape,\n shift = defaultPreset.params.shift,\n blur = defaultPreset.params.blur,\n edges = defaultPreset.params.edges,\n margin,\n marginLeft = margin ?? defaultPreset.params.marginLeft,\n marginRight = margin ?? defaultPreset.params.marginRight,\n marginTop = margin ?? defaultPreset.params.marginTop,\n marginBottom = margin ?? defaultPreset.params.marginBottom,\n grainMixer = defaultPreset.params.grainMixer,\n grainOverlay = defaultPreset.params.grainOverlay,\n stretch = defaultPreset.params.stretch,\n\n // integer `count` was deprecated in favor of the normalized `size` param\n count,\n size = count === undefined ? defaultPreset.params.size : Math.pow(1 / (count * 1.6), 1 / 6) / 0.7 - 0.5,\n\n // Sizing props\n fit = defaultPreset.params.fit,\n scale = defaultPreset.params.scale,\n rotation = defaultPreset.params.rotation,\n originX = defaultPreset.params.originX,\n originY = defaultPreset.params.originY,\n offsetX = defaultPreset.params.offsetX,\n offsetY = defaultPreset.params.offsetY,\n worldWidth = defaultPreset.params.worldWidth,\n worldHeight = defaultPreset.params.worldHeight,\n ...props\n}: FlutedGlassProps) {\n const uniforms = {\n // Own uniforms\n u_image: image,\n u_colorBack: getShaderColorFromString(colorBack),\n u_colorShadow: getShaderColorFromString(colorShadow),\n u_colorHighlight: getShaderColorFromString(colorHighlight),\n u_shadows: shadows,\n u_size: size,\n u_angle: angle,\n u_distortion: distortion,\n u_shift: shift,\n u_blur: blur,\n u_edges: edges,\n u_stretch: stretch,\n u_distortionShape: GlassDistortionShapes[distortionShape],\n u_highlights: highlights,\n u_shape: GlassGridShapes[shape],\n u_marginLeft: marginLeft,\n u_marginRight: marginRight,\n u_marginTop: marginTop,\n u_marginBottom: marginBottom,\n u_grainMixer: grainMixer,\n u_grainOverlay: grainOverlay,\n\n // Sizing uniforms\n u_fit: ShaderFitOptions[fit],\n u_scale: scale,\n u_rotation: rotation,\n u_offsetX: offsetX,\n u_offsetY: offsetY,\n u_originX: originX,\n u_originY: originY,\n u_worldWidth: worldWidth,\n u_worldHeight: worldHeight,\n } satisfies FlutedGlassUniforms;\n\n return (\n <ShaderMount\n {...props}\n speed={speed}\n frame={frame}\n fragmentShader={flutedGlassFragmentShader}\n acceptsHtmlChildren\n mipmaps={['u_image']}\n uniforms={uniforms}\n />\n );\n});\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,SAAS,YAAY;AACrB,SAAS,mBAA8C;AACvD;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAwNH;AA/MG,MAAM,gBAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,QAAQ;AAAA,IACN,GAAG;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW;AAAA,IACX,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,WAAW;AAAA,IACX,cAAc;AAAA,IACd,YAAY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6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ShaderComponentProps } from '../shader-mount.js';
|
|
2
|
+
import { type GemSmokeParams, type ImageShaderPreset } from '@paper-design/shaders';
|
|
3
|
+
export interface GemSmokeProps extends ShaderComponentProps, GemSmokeParams {
|
|
4
|
+
/**
|
|
5
|
+
* Suspends the component when the image is being processed.
|
|
6
|
+
*/
|
|
7
|
+
suspendWhenProcessingImage?: boolean;
|
|
8
|
+
}
|
|
9
|
+
type GemSmokePreset = ImageShaderPreset<GemSmokeParams>;
|
|
10
|
+
export declare const defaultPreset: GemSmokePreset;
|
|
11
|
+
export declare const fluorescentPreset: GemSmokePreset;
|
|
12
|
+
export declare const firePreset: GemSmokePreset;
|
|
13
|
+
export declare const infraredPreset: GemSmokePreset;
|
|
14
|
+
export declare const gemSmokePresets: GemSmokePreset[];
|
|
15
|
+
export declare const GemSmoke: React.FC<GemSmokeProps>;
|
|
16
|
+
export {};
|