# Data-anim – Animate HTML with just data attributes

Hey HN, I built data-anim — an animation library where you never have to write JavaScript yourself. You just write: <div data-anim="fadeInUp">Hello</div> That's it. Scroll-triggered fade-in animation, zero JS to write. What it does: - 30+ built-in animations (fade, slide, zoom, bounce, rotate, etc.…

- **Page:** https://magpie.gallery/i/data-anim-animate-html-with-just-data-attributes-v1bk
- **Type:** Link to an idea elsewhere
- **Category:** AI & dev
- **Runs on:** web
- **Tags:** animation, html, javascript, css, frontend

## Source

Web · ryo-manba: Data-anim – Animate HTML with just data attributes

- **Original:** https://news.ycombinator.com/item?id=47377195

> Hey HN, I built data-anim — an animation library where you never have to write JavaScript yourself. You just write: <div data-anim="fadeInUp">Hello</div> That's it. Scroll-triggered fade-in animation, zero JS to write. What it does: - 30+ built-in animations (fade, slide, zoom, bounce, rotate, etc.) - 4 triggers: scroll (default), load, click, hover - 3-layer anti-FOUC protection (immediate style injection → noscript fallback → 5s timeout) - Responsive controls: disable per device or swap animations on mobile - TypeScript autocomplete for all attributes - Under 3KB gzipped, zero dependencies Why I built this: I noticed that most animation needs on landing pages and marketing sites are simple — fade in on scroll, slide in from left, bounce on hover. But the existing options are either too heavy (Framer Motion ~30KB) or require JS boilerplate. I also think declarative HTML attributes are the most AI-friendly animation format. When LLMs generate UI, HTML attributes are the output they hallucinate least on — no selector matching, no JS API to misremember, no script execution order to get wrong. Docs: https://ryo-manba.github.io/data-anim/ Playground: https://ryo-manba.github.io/data-anim/playground/ npm: https://www.npmjs.com/package/data-anim Happy to answer any questions about the implementation or design decisions. https://github.com/ryo-manba/data-anim

## GitHub projects

- https://github.com/ryo-manba/data-anim

## Rules for reuse

- Build your own version: don't copy another product's code, look, icons, colours or copy.
- The original belongs to its author; Magpie only links to it.
- The original content's copyright belongs to its creator. Magpie doesn't download or re-upload it; we only show the link and the official preview.
