Communitygithub.com

Framer Motion — Librería de Animaciones para React

Biblioteca integral de animaciones con Framer Motion para React. Cubre componentes motion, variantes, gestos, transiciones de página y animaciones de scroll. Úsala para añadir animaciones a aplicaciones React/Next.js.

¿Qué es Framer Motion — Librería de Animaciones para React?

Esta habilidad proporciona un conjunto completo de herramientas y patrones listos para producción para crear animaciones en aplicaciones React y Next.js usando Framer Motion, la biblioteca de animación declarativa líder en el ecosistema. Cubre todos los conceptos fundamentales: el componente `<motion>` para animaciones simples y complejas, variantes para orquestar animaciones de múltiples elementos con desfase (stagger), gestos como hover y tap, transiciones de página con `AnimatePresence`, animaciones activadas por scroll con `whileInView`, arrastre (drag), y animaciones de layout. Incluye ejemplos prácticos de patrones comunes como listas escalonadas, modales, acordeones y micro-interacciones, así como una guía sobre funciones de easing (predefinidas y personalizadas) y tipos de transición (tween, spring, inertia). Se hace hincapié en las mejores prácticas de accesibilidad, respetando las preferencias de movimiento reducido del usuario mediante el hook `useReducedMotion`. La habilidad es compatible con todas las plataformas que ejecutan agentes AI como Claude Code, Cursor y Codex, y se activa automáticamente al detectar tareas relacionadas con animaciones en React.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/asmayaseen/framer-motion

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Habilidad de Framer Motion

Animaciones listas para producción en aplicaciones React.

Inicio Rápido

Instalación

npm install framer-motion
# o
pnpm add framer-motion

Uso Básico

import { motion } from "framer-motion";

// Animación simple
<motion.div
  initial={{ opacity: 0 }}
  animate={{ opacity: 1 }}
  transition={{ duration: 0.5 }}
>
  Contenido
</motion.div>

Conceptos Principales

ConceptoGuía
Componente Motionreference/motion-component.md
Variantesreference/variants.md
Gestosreference/gestures.md
Hooksreference/hooks.md

Ejemplos

PatrónGuía
Transiciones de Páginaexamples/page-transitions.md
Animaciones de Listaexamples/list-animations.md
Animaciones de Scrollexamples/scroll-animations.md
Micro-interaccionesexamples/micro-interactions.md

Plantillas

PlantillaPropósito
templates/page-transition.tsxEnvoltorio de transición de página
templates/animated-list.tsxComponente de lista animada

Referencia Rápida

Animación Básica

<motion.div
  initial={{ opacity: 0, y: 20 }}
  animate={{ opacity: 1, y: 0 }}
  exit={{ opacity: 0, y: -20 }}
  transition={{ duration: 0.3 }}
>
  Contenido
</motion.div>

Hover y Tap

<motion.button
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  transition={{ type: "spring", stiffness: 400, damping: 17 }}
>
  Haz clic en mí
</motion.button>

Variantes

const container = {
  hidden: { opacity: 0 },
  show: {
    opacity: 1,
    transition: { staggerChildren: 0.1 }
  }
};

const item = {
  hidden: { opacity: 0, y: 20 },
  show: { opacity: 1, y: 0 }
};

<motion.ul variants={container} initial="hidden" animate="show">
  {items.map(i => (
    <motion.li key={i} variants={item}>{i}</motion.li>
  ))}
</motion.ul>

AnimatePresence (Animaciones de Salida)

import { AnimatePresence, motion } from "framer-motion";

<AnimatePresence mode="wait">
  {isVisible && (
    <motion.div
      key="modal"
      initial={{ opacity: 0 }}
      animate={{ opacity: 1 }}
      exit={{ opacity: 0 }}
    >
      Contenido del modal
    </motion.div>
  )}
</AnimatePresence>

Disparador por Scroll

<motion.div
  initial={{ opacity: 0, y: 50 }}
  whileInView={{ opacity: 1, y: 0 }}
  viewport={{ once: true, margin: "-100px" }}
  transition={{ duration: 0.5 }}
>
  Se anima al hacer scroll hasta la vista
</motion.div>

Arrastre

<motion.div
  drag
  dragConstraints={{ left: -100, right: 100, top: -100, bottom: 100 }}
  dragElastic={0.1}
>
  Arrástrame
</motion.div>

Animación de Layout

<motion.div layout layoutId="shared-element">
  Contenido que se anima cuando el layout cambia
</motion.div>

Tipos de Transición

// Tween (predeterminado)
transition={{ duration: 0.3, ease: "easeOut" }}

// Spring
transition={{ type: "spring", stiffness: 300, damping: 20 }}

// Presets de Spring
transition={{ type: "spring", bounce: 0.25 }}

// Inertia (para arrastre)
transition={{ type: "inertia", velocity: 50 }}

Funciones de Easing

// Easings incorporados
ease: "linear"
ease: "easeIn"
ease: "easeOut"
ease: "easeInOut"
ease: "circIn"
ease: "circOut"
ease: "circInOut"
ease: "backIn"
ease: "backOut"
ease: "backInOut"

// Cubic-bezier personalizado
ease: [0.17, 0.67, 0.83, 0.67]

Movimiento Reducido

Respeta siempre las preferencias del usuario:

import { motion, useReducedMotion } from "framer-motion";

function Component() {
  const prefersReducedMotion = useReducedMotion();

  return (
    <motion.div
      initial={{ opacity: 0, y: prefersReducedMotion ? 0 : 20 }}
      animate={{ opacity: 1, y: 0 }}
      transition={{ duration: prefersReducedMotion ? 0 : 0.3 }}
    >
      Respeta las preferencias de movimiento
    </motion.div>
  );
}

// O usa una media query
const variants = {
  initial: { opacity: 0 },
  animate: { opacity: 1 },
};

<motion.div
  variants={variants}
  initial="initial"
  animate="animate"
  className="motion-reduce:transition-none"
>

Patrones Comunes

Aparición desde Abajo

const fadeInUp = {
  initial: { opacity: 0, y: 20 },
  animate: { opacity: 1, y: 0 },
  transition: { duration: 0.4 }
};

<motion.div {...fadeInUp}>Contenido</motion.div>

Lista Escalonada

const container = {
  hidden: { opacity: 0 },
  show: {
    opacity: 1,
    transition: { staggerChildren: 0.1, delayChildren: 0.2 }
  }
};

const item = {
  hidden: { opacity: 0, x: -20 },
  show: { opacity: 1, x: 0 }
};

Modal

<AnimatePresence>
  {isOpen && (
    <>
      {/* Fondo */}
      <motion.div
        initial={{ opacity: 0 }}
        animate={{ opacity: 1 }}
        exit={{ opacity: 0 }}
        className="fixed inset-0 bg-black/50"
        onClick={onClose}
      />
      {/* Modal */}
      <motion.div
        initial={{ opacity: 0, scale: 0.95 }}
        animate={{ opacity: 1, scale: 1 }}
        exit={{ opacity: 0, scale: 0.95 }}
        className="fixed inset-x-4 top-1/2 -translate-y-1/2 ..."
      >
        Contenido del modal
      </motion.div>
    </>
  )}
</AnimatePresence>

Acordeón

<motion.div
  initial={false}
  animate={{ height: isOpen ? "auto" : 0 }}
  transition={{ duration: 0.3, ease: "easeInOut" }}
  className="overflow-hidden"
>
  <div className="p-4">Contenido del acordeón</div>
</motion.div>

Buenas Prácticas

  1. Usa variantes: Código más limpio y orquestación más sencilla
  2. Respeta el movimiento reducido: Siempre verifica useReducedMotion
  3. Usa layout con moderación: Puede ser costoso, úsalo solo cuando sea necesario
  4. Animaciones de salida: Envuelve con AnimatePresence
  5. Spring para interacciones: Sensación más natural para hover/tap
  6. Tween para transiciones de página: Tiempo más predecible
  7. Propiedades aceleradas por GPU: Prefiere opacity, scale, x, y sobre width, height

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Next.js 16+ uses App Router with Server Components by default. Client Components are only used when interactivity is needed (hooks, event handlers, browser APIs).

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

Skills relacionados