/** * Zoom Blur - Blurs the image away from a certain point, which looks like radial motion blur. */ export type ZoomBlurProps = { /** - The x, y coordinate of the blur origin. */ center?: [number, number]; /** - The strength of the blur. Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 creates a highly blurred image. */ strength?: number; }; export type ZoomBlurUniforms = ZoomBlurProps; /** * Zoom Blur * Blurs the image away from a certain point, which looks like radial motion blur. */ export declare const zoomBlur: { readonly name: "zoomBlur"; readonly dependencies: [{ readonly name: "random"; readonly source: "fn random(scale: vec3f, seed: float) -> f32 {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n"; readonly fs: "float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n"; }]; readonly source: "\nuniform zoomBlurUniforms {\n center: vec2f,\n strength: f32,\n};\n\n@group(0) @binding(1) var zoomBlur : zoomBlurUniforms;\n\n\nfn zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n"; readonly fs: "\nuniform zoomBlurUniforms {\n vec2 center;\n float strength;\n} zoomBlur;\n\nvec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n"; readonly props: ZoomBlurProps; readonly uniforms: ZoomBlurUniforms; readonly uniformTypes: { readonly center: "vec2"; readonly strength: "f32"; }; readonly propTypes: { readonly center: { readonly value: readonly [0.5, 0.5]; }; readonly strength: { readonly value: 0.3; readonly min: 0; readonly softMax: 1; }; }; readonly passes: [{ readonly sampler: true; }]; }; //# sourceMappingURL=zoomblur.d.ts.map