Skip to content

Packs / web-development-public

text-ui-animations

Dependency-free text and UI animation kit driven by data attributes: split-word reveal on scroll, typewriter, scramble, seamless marquee, eased counters, magnetic button, draw-in underline. Accessible labels kept, everything static under reduced motion.

Install

logicpacks pack use web-development-public/text-ui-animations
get_pack web-development-public/text-ui-animations

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: static-local
  • Checks: 1 in outcome/checks.yaml
  • Code: _shots/shot-1280-rm.png_shots/shot-1280.png_shots/shot-390-rm.png_shots/shot-390.pnganim.cssanim.jsdemo.cssindex.html
  • Tools: python3, playwright-python, chromium

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

Small, reusable motion that makes a page feel alive without a library: each effect is one data attribute, uses only transform/opacity (or text content), keeps the real text accessible, and turns off under prefers-reduced-motion.

Steps

  1. Copy code/anim.css and code/anim.js (demo.css is only the showcase).
  2. Mark up elements:
    • data-split on a heading: words rise in when 30% visible (stagger 45 ms per word).
    • data-type='["a","b"]' on a span: types and deletes words in a loop.
    • data-scramble on short text (< 40 chars): glyphs resolve left to right on enter.
    • data-marquee wrapper with .marquee-track list: items are cloned once (clones aria-hidden), loop at --speed, pause on hover/focus.
    • data-count="1280" (+ data-decimals, data-prefix, data-suffix): eased count-up on enter, ends on the exact value.
    • data-magnetic on a button: follows a fine pointer by 25-35%.
    • .ul on a link: underline draws in on hover/focus.
  3. Use at most 2-3 effects per page; reserve split reveal for the hero or section titles.
  4. Run the outcome checks.

Edge cases

  • Screen readers: split and scramble set aria-label with the real text; split pieces are aria-hidden.
  • SEO: the initial HTML contains the final text (counters render the final value under reduced motion; set the final value in HTML if you need it without JS).
  • Marquee with few items on wide screens: add items until one copy is wider than the viewport.
  • Fonts with ligatures in scramble: font-variant-ligatures: none avoids jitter.
  • Touch devices: magnetic effect is skipped (pointer: fine only).

Don'ts

  • No animation on body paragraphs or long text.
  • Do not animate letter-by-letter on headings longer than ~10 words (too slow, hurts LCP perception).
  • Never loop the typewriter on critical copy (the CTA or the value proposition).
  • Do not use the annnimate or prompt-motion code; they are reference only.