Content swells outward or pinches inward around a chosen point.
Also known as: BulgePinchBulge/Pinch
Moves in browsers that support WebGPU
This device could not render the demo — showing a still
Code reflects the control values
React
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
import { Shader, Bulge, ImageTexture } from 'shaders/react'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: 320 }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<Bulge />
</Shader>
)
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<!-- /samples/… are this site’s sample files — point them at your own image or video. -->
<script setup lang="ts">
import { Shader, Bulge, ImageTexture } from 'shaders/vue'
</script>
<template>
<Shader style="width: 100%; height: 320px" :disable-telemetry="true">
<ImageTexture
object-fit="cover"
url="/samples/poster.jpg"/>
<Bulge/>
</Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<!-- /samples/… are this site’s sample files — point them at your own image or video. -->
<script>
import { Shader, Bulge, ImageTexture } from 'shaders/svelte'
</script>
<Shader style="width: 100%; height: 320px" disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<Bulge />
</Shader>
Solid
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
import { Shader, Bulge, ImageTexture } from 'shaders/solid'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<Bulge />
</Shader>
)
}
JavaScript
// Renders only in browsers with WebGPU.
// /samples/… are this site’s sample files — point them at your own image or video.
// expects <canvas id="canvas" style="width:100%;height:320px"></canvas> on the page
import { createShader } from 'shaders/js'
const shader = await createShader(document.getElementById("canvas"), {
components: [
{
type: 'ImageTexture',
props: {
objectFit: 'cover',
url: '/samples/poster.jpg',
},
},
{
type: 'Bulge',
}
]
}, { disableTelemetry: true })
Props · Bulge
Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).
Name
Value
Default
Range / options
Description
centerCenter
xy
{"x":0.5,"y":0.5}
x, y: 0 – 1
The center point of the bulge effect
strengthStrength
1
-1 – 1 (step 0.01)
The intensity of the bulge effect (positive = bulge out, negative = pinch in)
radiusRadius
1
0 – 5 (step 0.1)
The radius of the bulge effect area
falloffFalloff
0.5
0 – 1 (step 0.01)
Controls the smoothness of the transition (0 = hard edge, 1 = very smooth)
edgesEdges
stretch
stretch · transparent · mirror · wrap
How to handle edges when distortion pushes content out of bounds
Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id
Like a magnifying lens pressed into a picture, the area around one point swells outward or caves inward.
Set the position with `center`. Positive `strength` pushes content outward and negative `strength` pinches it inward; `radius` changes the affected area, while `falloff` softens its boundary.
Place it above an image or pattern layer. `edges` controls what appears beyond the canvas. Text is distorted along with the image, so separate the background from details that should stay sharp.
When to use
Use it for lens-like emphasis, inflated forms, and short elastic transitions. Avoid it for copy or detailed UI that must remain undistorted.