/** Bulges or pinches the image in a circle. */ export type BulgePinchProps = { /** The [x, y] coordinates of the center of the circle of effect. */ center?: [number, number]; /** The radius of the circle of effect. */ radius?: number; /** strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge) */ strength?: number; }; export type BulgePinchUniforms = BulgePinchProps; /** * Bulge / Pinch - * Bulges or pinches the image in a circle. */ export declare const bulgePinch: { readonly name: "bulgePinch"; readonly dependencies: [{ readonly name: "warp"; readonly source: "vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {\n vec4 color = texture(source, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n return color;\n}\n"; readonly fs: "vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {\n vec4 color = texture(source, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n return color;\n}\n"; readonly passes: []; }]; readonly source: "uniform bulgePinchUniforms {\n radius: f32,\n strength: f32,\n center: vec2f,\n};\n\n@group(0) @binding(1) var bulgePinch: bulgePinchUniforms;\n\nfn bulgePinch_warp(vec2 coord, vec2 texCenter) -> vec2f {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < bulgePinch.radius) {\n float percent = distance / bulgePinch.radius;\n if (bulgePinch.strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nfn bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, bulgePinch.center * texSize);\n return warp_sampleColor(source, texSize, coord);\n}\n"; readonly fs: "uniform bulgePinchUniforms {\n float radius;\n float strength;\n vec2 center;\n} bulgePinch;\n\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < bulgePinch.radius) {\n float percent = distance / bulgePinch.radius;\n if (bulgePinch.strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, bulgePinch.center * texSize);\n\n return warp_sampleColor(source, texSize, coord);\n}\n"; readonly props: BulgePinchProps; readonly uniforms: BulgePinchUniforms; readonly uniformTypes: { readonly center: "vec2"; readonly radius: "f32"; readonly strength: "f32"; }; readonly propTypes: { readonly center: { readonly value: readonly [0.5, 0.5]; }; readonly radius: { readonly value: 200; readonly min: 1; readonly softMax: 600; }; readonly strength: { readonly value: 0.5; readonly min: -1; readonly max: 1; }; }; readonly passes: [{ readonly sampler: true; }]; }; //# sourceMappingURL=bulgepinch.d.ts.map