Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

animejs-motion

БесплатноБез исполняемых скриптовНе проверен

Motor de animaciones de alta precisión con Anime.js. Timelines secuenciales, morphing de SVG, trazado de rutas vectoriales, efectos stagger para cuadrículas…

Hectr203от Hectr203★ 21 звезда на GitHub

Об этом скилле

Anime.js Motion Engineering

Guía y recetas de producción para integrar Anime.js en proyectos web. Proporciona control milimétrico sobre animaciones complejas de SVG, orquestación secuencial mediante líneas de tiempo (timelines), efectos escalonados (stagger) e interpolación de números para dashboards y métricas de alto rendimiento.


1. Repositorio Oficial y Documentación

  • Repositorio GitHub: github.com/juliangarnier/anime
  • Sitio Oficial y Demos: animejs.com
  • Instalación en proyectos:
    # Instalación en el frontend
    npm install animejs
    npm install -D @types/animejs
    
    O mediante CDN para prototipos rápidos:
    <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
    

2. Principios de Integración y Rendimiento

  1. Propiedades Aceleradas por Hardware: Animar exclusivamente transform (translateX, translateY, scale, rotate) y opacity. Evitar animar width, height, top o left directamente para prevenir layout thrashing o reflujos del navegador.
  2. Ciclo de Vida Limpio en React: Toda animación en componentes React debe almacenar la instancia en un ref y pausar o cancelar la ejecución al desmontar el componente (animeInstance.pause()).
  3. Respeto a Preferencias del Usuario: Detectar siempre prefers-reduced-motion:
    const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
    if (prefersReducedMotion) {
      // Desactivar animaciones o fijar duraciones a 0
    }
    

3. Recetas de Producción Listas para Usar

Receta 1: Hook Personalizado en React (useAnime) Interrumpible

Este hook garantiza que las animaciones se limpien adecuadamente y no acumulen fugas de memoria ni colisiones entre renders:

import { useEffect, useRef } from 'react';
import anime from 'animejs';

export function useAnime(
  targetRef: React.RefObject<HTMLElement | SVGElement | null>,
  params: anime.AnimeParams,
  dependencies: any[] = []
) {
  const animationRef = useRef<anime.AnimeInstance | null>(null);

  useEffect(() => {
    if (!targetRef.current) return;

    // Si el usuario prefiere movimiento reducido, saltar animación
    const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
    if (prefersReducedMotion) {
      return;
    }

    // Cancelar animación anterior si estaba corriendo
    if (animationRef.current) {
      animationRef.current.pause();
    }

    // Iniciar animación con el target referenciado
    animationRef.current = anime({
      targets: targetRef.current,
      ...params,
    });

    return () => {
      if (animationRef.current) {
        animationRef.current.pause();
      }
    };
  }, dependencies);

  return animationRef;
}

Receta 2: Efecto Escalonado para Cuadrículas y Listas (Stagger)

Ideal para revelar tarjetas de productos, elementos de catálogo o filas de una tabla con fluidez:

import anime from 'animejs';

export function animateStaggeredGrid(containerSelector: string) {
  return anime({
    targets: `${containerSelector} .grid-card`,
    opacity: [0, 1],
    translateY: [24, 0],
    scale: [0.96, 1],
    delay: anime.stagger(45, { from: 'first', start: 100 }), // 45ms entre cada elemento
    duration: 380,
    easing: 'cubicBezier(0.16, 1, 0.3, 1)', // Curva suave Apple-style
  });
}

Receta 3: Línea de Tiempo Secuencial (Timeline Orchestration)

Permite encadenar secuencias sincronizadas sin anidar callbacks complejos (callback hell):

import anime from 'animejs';

export function playHeroSequence(elements: {
  badge: HTMLElement;
  title: HTMLElement;
  cta: HTMLElement;
  illustration: SVGElement;
}) {
  const timeline = anime.timeline({
    easing: 'cubicBezier(0.16, 1, 0.3, 1)',
    duration: 400,
  });

  timeline
    .add({
      targets: elements.badge,
      opacity: [0, 1],
      translateY: [-10, 0],
      duration: 300,
    })
    .add({
      targets: elements.title,
      opacity: [0, 1],
      translateY: [20, 0],
    }, '-=150') // Se solapa 150ms con el anterior para máxima fluidez
    .add({
      targets: elements.cta,
      opacity: [0, 1],
      scale: [0.94, 1],
      duration: 350,
    }, '-=200')
    .add({
      targets: elements.illustration.querySelectorAll('path'),
      strokeDashoffset: [anime.setDashoffset, 0],
      easing: 'easeInOutSine',
      duration: 700,
      delay: anime.stagger(60),
    }, '-=250');

  return timeline;
}

Receta 4: Dibujo de Rutas SVG y Morphing Vectorial

A. Dibujo progresivo de trazos vectoriales (Line Drawing):

anime({
  targets: '.svg-path-illustration path',
  strokeDashoffset: [anime.setDashoffset, 0],
  easing: 'easeInOutCubic',
  duration: 900,
  delay: anime.stagger(80),
  direction: 'alternate',
  loop: false,
})
Полный SKILL.md на GitHub

Установить animejs-motion в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл animejs-motion?

Motor de animaciones de alta precisión con Anime.js. Timelines secuenciales, morphing de SVG, trazado de rutas vectoriales, efectos stagger para cuadrículas, interpolación de métricas y físicas de movimiento elástico sin sobrecarga.

Как установить скилл animejs-motion?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл animejs-motion запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить animejs-motion с