img-auto-parallax

antfu

A drop-in web component that estimates image depth on the GPU to add hover and tilt parallax effects.

TypeScriptCreated

What is antfu/img-auto-parallax?

img-auto-parallax is a drop-in TypeScript web component that estimates depth directly on the user's GPU and applies a parallax motion effect to any photo as a visitor hovers or tilts their phone. Powered by Vercel's vgpu library, it operates entirely on the client device and renders as a standard static image whenever WebGPU is unavailable.

Because WebGPU and device motion events require a protected origin in browsers, sites must be served over HTTPS or localhost for the depth and tilt behavior to activate. On iOS Safari, device gyroscope access also prompts for user permission upon tapping an image, or via helper functions attached to a click handler.

Web developers can add the package with pnpm and import the component definition under an MIT license, with the bundled depth model licensed under Apache-2.0.

depth-estimationphoto-galleryvgpuwebcomponentswebglwebgpu

Before you startThe README says

Runs on
In the browser (renders as plain image without WebGPU)
Needs
HTTPS or localhost for WebGPU and motion events; pnpm to develop
How you get it
Install via pnpm add img-auto-parallax
Asks for
iOS Safari prompts for device motion gyro permission on user tap

Facts from GitHub (updated Dec 1, 2026) and the project's README. License summaries are simplified: check the license file. RepoRanking reviews listings for relevance and spam, and doesn't test or vouch for code.