Skills2026年4月27日·1 分钟阅读

AutoAnimate — Zero-Config Drop-In Animations for Web Apps

AutoAnimate is a lightweight library that automatically adds smooth transitions when DOM elements are added, removed, or moved, with a single function call and no configuration required.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
AutoAnimate Transitions
直接安装命令
npx -y tokrepo@latest install cfa3df11-41f2-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

AutoAnimate watches a parent element for child additions, removals, and position changes, then applies smooth CSS transitions automatically. It works with any framework or vanilla JavaScript and requires no keyframes, classes, or animation configuration.

What AutoAnimate Does

  • Detects when children are added and animates them in with opacity and scale
  • Animates removal of children with a fade-out transition
  • Tracks position changes and applies smooth movement transitions
  • Provides framework hooks for React, Vue, Solid, Svelte, and Angular
  • Supports custom animation plugins for full control over keyframes

Architecture Overview

AutoAnimate uses a MutationObserver to watch a parent element for childList changes. When mutations fire, it snapshots the previous and current positions of all children, then applies Web Animations API keyframes to transition between states. The entire logic is under 2KB gzipped with no external dependencies.

Self-Hosting & Configuration

  • Install @formkit/auto-animate via npm or yarn
  • For vanilla JS, call autoAnimate(parentElement) on any container
  • For React, use the useAutoAnimate hook and attach the ref to the parent
  • For Vue, use the v-auto-animate directive provided by the plugin
  • Pass a duration number (milliseconds) or a custom animation function to override defaults

Key Features

  • Single function call activates entry, exit, and move animations
  • Under 2KB gzipped with zero dependencies
  • Uses the Web Animations API for hardware-accelerated transitions
  • Framework adapters for React, Vue, Solid, Svelte, and Angular
  • Custom plugin API for defining your own keyframes and timing

Comparison with Similar Tools

  • React Spring — physics-based with fine-grained control, requires explicit animation setup
  • Framer Motion — layout animations and gestures, larger bundle
  • FLIP technique (manual) — same underlying concept but requires manual implementation
  • Vue Transition Group — Vue-specific, requires CSS classes for each state
  • AnimatePresence (Motion) — handles mount/unmount but needs wrapper components

FAQ

Q: Does AutoAnimate work with any framework? A: Yes. It has adapters for React, Vue, Solid, Svelte, Angular, and works with vanilla JS.

Q: How large is the bundle? A: Under 2KB gzipped with no dependencies.

Q: Can I customize the animation? A: Yes. Pass a custom function that receives the element, action, and coordinates, then return a KeyframeEffect.

Q: Does it handle list reordering? A: Yes. It detects position changes and smoothly moves elements to their new locations.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产