Communitygithub.com

Kiddo4993/Claude-Skills

Implemente animações baseadas em rolagem — parallax, revelar ao rolar, indicadores de progresso, cabeçalhos fixos e sequências GSAP ScrollTrigger usadas em sites de agências e produtos.

O que é Claude-Skills?

Esta skill capacita o agente a implementar animações de alto nível baseadas em rolagem, típicas de sites de agências e produtos premium. Ela cobre duas abordagens principais: Framer Motion (para componentes React e elementos únicos) e GSAP ScrollTrigger (para cronogramas complexos, sequências fixas e scrubbing). Entre os efeitos práticos fornecidos estão: fade + slide ao revelar, barra de progresso de rolagem, parallax em hero images, rolagem horizontal fixa (estilo Awwwards) e revelação escalonada de texto. A skill também inclui regras de performance cruciais, como animar apenas transform e opacity, usar `will-change: transform` e limpar instâncias do ScrollTrigger. Suporta plataformas como Claude Code, Cursor e Codex, ajudando desenvolvedores a criar interações rolagem suaves e cinematográficas sem causar enjoo de movimento.

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

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Prévia

Do README da skill

Claude-Skills preview

Documentação

Skill de Animações de Rolagem — Qualidade de Agência / Produto

Animações de rolagem são como sites de alto orçamento ganham seu orçamento. Feitas corretamente, parecem cinematográficas. Feitas erradas, causam enjoo de movimento. Esta skill as implementa corretamente.

Duas abordagens

Caso de usoFerramenta
Componentes React, elementos únicosFramer Motion useScroll + useTransform
Cronogramas complexos, sequências fixas, scrubbingGSAP ScrollTrigger

Framer Motion: Fade + Slide ao entrar na rolagem

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 progresso de rolagem

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: Imagem hero com parallax

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">Texto Hero</h1>
      </motion.div>
    </section>
  )
}

GSAP ScrollTrigger: Rolagem horizontal fixa (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: Revelação escalonada de texto (linha por linha)

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())
}, [])

Regras de performance para animações de rolagem

  • Anime apenas transform e opacity — nunca top, left, width, height
  • Adicione will-change: transform a elementos que animam continuamente com rolagem
  • Sempre limpe instâncias do ScrollTrigger no retorno do useEffect
  • Use scrub: 1 (não scrub: true) para scrubbing suave
  • Teste em um dispositivo Android de baixo custo — se perder quadros lá, o envio está quebrado
  • margin: '-80px 0px' no useInView evita que animações disparem muito cedo

Individual skills in this repo

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

Habilidades Relacionadas