Communitygithub.com

Kiddo4993/Claude-Skills

Implementa animaciones basadas en desplazamiento: paralaje, revelación al hacer scroll, indicadores de progreso, encabezados fijos y secuencias de GSAP ScrollTrigger utilizadas en sitios de agencias y productos.

¿Qué es Claude-Skills?

Esta habilidad permite a desarrolladores implementar animaciones de desplazamiento de alta calidad, como las que se ven en sitios web de agencias y productos. Proporciona dos enfoques principales: Framer Motion para componentes React y elementos individuales, y GSAP ScrollTrigger para secuencias complejas con timeline, pines y scrubbing. Incluye ejemplos prácticos como paralaje, barras de progreso, revelación de texto, desplazamiento horizontal y más. Además, incorpora reglas de rendimiento esenciales para garantizar animaciones suaves en dispositivos de gama baja. Es compatible con asistentes de IA como Claude Code, Cursor y Codex, y se integra fácilmente en proyectos que usan React y GSAP.

Compatible con✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Kiddo4993/Claude-Skills/tree/HEAD/scroll-animations

Preguntar en tu IA favorita

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

Vista previa

Del README del skill

Claude-Skills preview

Documentación

Habilidad de Animaciones de Desplazamiento — Calidad de Agencia / Producto

Las animaciones de desplazamiento son la razón por la que los sitios de alto presupuesto justifican su inversión. Bien hechas, se sienten cinematográficas. Mal hechas, causan mareos. Esta habilidad las implementa correctamente.

Dos enfoques

Caso de usoHerramienta
Componentes React, elementos individualesFramer Motion useScroll + useTransform
Secuencias complejas, secuencias ancladas, scrubbingGSAP ScrollTrigger

Framer Motion: Desvanecer + deslizar al entrar en scroll

import { motion, useInView } from 'framer-motion'
import { useRef } from 'react'

function RevealOnScroll({ children, delay = 0 }: { children: React.ReactNode; delay?: number }) {
  const ref = useRef(null)
  const isInView = useInView(ref, { once: true, margin: '-80px 0px' })

  return (
    <motion.div
      ref={ref}
      initial={{ opacity: 0, y: 32, filter: 'blur(6px)' }}
      animate={isInView ? { opacity: 1, y: 0, filter: 'blur(0px)' } : {}}
      transition={{ type: 'spring', stiffness: 200, damping: 24, delay }}
    >
      {children}
    </motion.div>
  )
}

Framer Motion: Barra de progreso de scroll

import { useScroll, useSpring, motion } from 'framer-motion'

function ScrollProgressBar() {
  const { scrollYProgress } = useScroll()
  const scaleX = useSpring(scrollYProgress, { stiffness: 100, damping: 30 })

  return (
    <motion.div
      className="fixed top-0 left-0 right-0 h-[3px] bg-blue-500 origin-left z-50"
      style={{ scaleX }}
    />
  )
}

Framer Motion: Imagen de héroe con paralaje

import { useScroll, useTransform, motion } from 'framer-motion'
import { useRef } from 'react'

function ParallaxHero() {
  const ref = useRef(null)
  const { scrollYProgress } = useScroll({ target: ref, offset: ['start start', 'end start'] })
  const y = useTransform(scrollYProgress, [0, 1], ['0%', '30%'])
  const opacity = useTransform(scrollYProgress, [0, 0.6], [1, 0])

  return (
    <section ref={ref} className="relative h-screen overflow-hidden">
      <motion.div className="absolute inset-0" style={{ y }}>
        <img src="/hero.jpg" className="w-full h-full object-cover" alt="" />
      </motion.div>
      <motion.div className="relative z-10 flex items-center justify-center h-full" style={{ opacity }}>
        <h1 className="text-white text-7xl font-bold">Hero Text</h1>
      </motion.div>
    </section>
  )
}

GSAP ScrollTrigger: Desplazamiento horizontal anclado (estilo Awwwards)

import { useEffect, useRef } from 'react'
import { gsap } from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'

gsap.registerPlugin(ScrollTrigger)

function HorizontalScrollSection() {
  const sectionRef = useRef(null)
  const trackRef = useRef(null)

  useEffect(() => {
    const track = trackRef.current
    const totalWidth = track.scrollWidth - window.innerWidth

    gsap.to(track, {
      x: -totalWidth,
      ease: 'none',
      scrollTrigger: {
        trigger: sectionRef.current,
        start: 'top top',
        end: `+=${totalWidth}`,
        scrub: 1,
        pin: true,
        anticipatePin: 1,
      }
    })

    return () => ScrollTrigger.getAll().forEach(t => t.kill())
  }, [])

  return (
    <section ref={sectionRef} className="overflow-hidden">
      <div ref={trackRef} className="flex w-max gap-8 p-16">
        {panels.map((panel, i) => (
          <div key={i} className="w-[80vw] h-screen flex-shrink-0 bg-gray-100 rounded-2xl" />
        ))}
      </div>
    </section>
  )
}

GSAP ScrollTrigger: Revelación de texto escalonada (línea por línea)

useEffect(() => {
  const lines = gsap.utils.toArray('.reveal-line')

  lines.forEach((line, i) => {
    gsap.fromTo(line,
      { y: '100%', opacity: 0 },
      {
        y: '0%',
        opacity: 1,
        duration: 0.8,
        ease: 'power3.out',
        delay: i * 0.1,
        scrollTrigger: {
          trigger: line,
          start: 'top 90%',
          toggleActions: 'play none none none'
        }
      }
    )
  })

  return () => ScrollTrigger.getAll().forEach(t => t.kill())
}, [])

Reglas de rendimiento para animaciones de desplazamiento

  • Animar solo transform y opacity — nunca top, left, width, height
  • Agregar will-change: transform a elementos que se animan continuamente con el scroll
  • Siempre limpiar las instancias de ScrollTrigger en el return de useEffect
  • Usar scrub: 1 (no scrub: true) para un scrubbing suave
  • Probar en un dispositivo Android de gama baja — si pierde fotogramas allí, se envía roto
  • margin: '-80px 0px' en useInView evita que las animaciones se disparen demasiado pronto

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

Skills relacionados