The pointer brush sorts pixels by brightness and leaves the rearrangement behind.
Also known as: PixelSortpixel sortingbrightness sorting
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, ImageTexture, PixelSort } from 'shaders/react'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: 320 }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/still.jpg" />
<PixelSort />
</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, ImageTexture, PixelSort } from 'shaders/vue'
</script>
<template>
<Shader style="width: 100%; height: 320px" :disable-telemetry="true">
<ImageTexture
object-fit="cover"
url="/samples/still.jpg"/>
<PixelSort/>
</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, ImageTexture, PixelSort } from 'shaders/svelte'
</script>
<Shader style="width: 100%; height: 320px" disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/still.jpg" />
<PixelSort />
</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, ImageTexture, PixelSort } from 'shaders/solid'
export default function ShaderEffect() {
return (
<Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
<ImageTexture
objectFit="cover"
url="/samples/still.jpg" />
<PixelSort />
</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/still.jpg',
},
},
{
type: 'PixelSort',
}
]
}, { disableTelemetry: true })
Props · PixelSort
Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).
Name
Value
Default
Range / options
Description
radiusRadius
0.4
0.03 – 0.6 (step 0.01)
Size of the cursor brush that sorts pixels
falloffFalloff
1
0 – 1 (step 0.01)
Softness of the brush edge (0 = hard circle, 1 = very soft)
strengthStrength
0.1
0 – 1 (step 0.01)
How fast pixels sort — runs more sorting passes per frame
decayDecay
0.1
0 – 1 (step 0.01)
How quickly sorted pixels melt back to their original position (0 = permanent)
axisAxis
vertical
horizontal · vertical
Axis pixels are sorted along
directionDirection
descending
ascending · descending
Sort order by brightness
Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id
Pixels under the pointer brush line up by brightness, breaking the image into streaks. It looks like photo fragments pushed into order from light to dark.
`radius` sets brush size (default 0.4, range 0.03–0.6), `falloff` softens its edge (default 1, range 0–1), and `strength` sets sorting speed (default 0.1, range 0–1). `axis` chooses the sorting direction (default `vertical`); `decay` controls how quickly sorted pixels return (default 0.1, range 0–1).
This effect needs a photo or image beneath it to sort. A photo with clear light and dark areas makes the change visible; small text and interface screenshots can become difficult to read.
When to use
Use it for pointer-driven glitch on a photo, a brief hero-image treatment, or a visual transition. Avoid it where text or interface captures must remain readable.