An <img> drop-in WebComponent that brings any photo to life with depth and parallax effects, right on the device.
🌈 Playground & Documentation →
pnpm add img-auto-parallax// register WebComponent <img-auto-parallax>
import 'img-auto-parallax/define'<!-- use <img-auto-parallax> to replace a plain <img> -->
<img-auto-parallax src="/photo.jpg" alt="A mountain lake"></img-auto-parallax>Powered by vgpu by Vercel.
- HTTPS. WebGPU and device motion events require a secure context. Serve the page over
https://, or uselocalhostduring development. Over plainhttp://, every element renders as a normal<img>. - WebGL fallback. Live depth estimation requires WebGPU. On devices without a WebGPU adapter, provide a precompiled depth map with
src-depthand the default image layer renders with WebGL. Depth of field and separate foreground/background layers require WebGPU. - Gyro permission. iOS Safari requires a user gesture before sharing device motion. Tapping an image prompts automatically. To prompt from your own UI, call
getGyroPermission()andrequestGyroPermission()inside a click handler. Withtrigger="auto", touch devices fall back to scroll position until valid tilt readings arrive (respecting reduced motion).
pnpm install
pnpm dev # docs + playground, using the library source
pnpm run ci # lint, typecheck, knip, build, testMIT.
The bundled model is licensed under Apache-2.0. See models/NOTICE.md.