The grid bends around the pointer and locally shifts the image beneath it.
Also known as: GridDistortiongrid warpmesh distortion
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, GridDistortion, ImageTexture } from 'shaders/react'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: 320 }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<GridDistortion />
</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, GridDistortion, ImageTexture } from 'shaders/vue'
</script>
<template>
<Shader style="width: 100%; height: 320px" :disable-telemetry="true">
<ImageTexture
object-fit="cover"
url="/samples/poster.jpg"/>
<GridDistortion/>
</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, GridDistortion, ImageTexture } from 'shaders/svelte'
</script>
<Shader style="width: 100%; height: 320px" disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<GridDistortion />
</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, GridDistortion, ImageTexture } from 'shaders/solid'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/poster.jpg" />
<GridDistortion />
</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: 'GridDistortion',
}
]
}, { disableTelemetry: true })
Props · GridDistortion
Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).
Name
Value
Default
Range / options
Description
intensityIntensity
1
0 – 5 (step 0.1)
Strength of the distortion effect
decayDecay
3
0 – 10 (step 0.1)
Rate of distortion decay (higher = faster)
radiusRadius
1
0 – 3 (step 0.1)
Radius of the distortion effect
gridSizeGrid Size
20
8 – 128 (step 1)
Resolution of the distortion grid (higher = more detailed)
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
The grid bends around the pointer and shifts the image beneath it. It is like pressing a rubber sheet from below and watching its lines flex.
`intensity` sets how far the image moves (default 1, range 0–5), `decay` controls how quickly the distortion relaxes (default 3, range 0–10; higher is faster), and `radius` sets the affected area (default 1, range 0–3). `gridSize` sets grid detail (default 20, range 8–128).
This effect needs an image or shape beneath it. Broad photos and gradients make the bend easy to see; a fine grid and strong movement can disrupt small text and thin lines.
When to use
Use it for pointer response on a hero image, a brief distortion on a card thumbnail, or a broad graphic background. Avoid it when small text or precise lines need to remain intact.