← Open Source

An <img> drop-in WebComponent that brings any photo to life with depth and parallax effects, right on the device.

TypeScript
Momentum
+37stars in 24 hours+4.3%
905
Stars
38
Forks
4
Contributors
Created 2026-11-30 · Updated 2026-12-05 · #402 today
Top developers
antfucheezonedrichar
README

img-auto-parallax

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.

Requirements

  • HTTPS. WebGPU and device motion events require a secure context. Serve the page over https://, or use localhost during development. Over plain http://, 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-depth and 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() and requestGyroPermission() inside a click handler. With trigger="auto", touch devices fall back to scroll position until valid tilt readings arrive (respecting reduced motion).

Development

pnpm install
pnpm dev        # docs + playground, using the library source
pnpm run ci     # lint, typecheck, knip, build, test

Sponsors

License

MIT.

The bundled model is licensed under Apache-2.0. See models/NOTICE.md.

Nearby in the ranking

AI Rank for iPhone

Follow AI model rankings

Download on the App Store