Communitygithub.com

MengTo/Skills

Crie sistemas de movimento web cinemáticos premium com GSAP, ScrollTrigger e Lenis. Ideal para sites editoriais de luxo, portfólios de estúdios criativos, interações no estilo Awwwards, revelações suaves de rolagem, texto escalonado, parallax, seções fixas, estados magnéticos de hover, cursores personalizados e movimento em camadas reativo ao mouse.

O que é Skills?

Esta skill define um sistema de movimento cinematográfico completo para a web, utilizando GSAP, ScrollTrigger e Lenis para criar experiências de rolagem suaves e animações de alto nível, típicas de sites editoriais de luxo e portfólios criativos. Ela oferece uma abordagem coesa e reutilizável, indo além de animações isoladas, conectando rolagem suave, revelações, parallax, interações de hover e cursor personalizado em um único ecossistema. A skill é ideal para desenvolvedores que buscam um padrão elegante e intencional, evitando movimentos bruscos ou excessivos, e priorizando a sutileza e profundidade visual. Ela suporta plataformas que utilizam GSAP, ScrollTrigger e Lenis, fornecendo uma API baseada em atributos de dados, tokens de animação predefinidos e funções utilitárias para implementar reveals de texto escalonado, reveals de scroll, reveals de imagem com clipping, parallax, seções fixas com galerias horizontais ou storytelling, interações magnéticas e um cursor customizado com efeito de diferença.

Funciona com~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/MengTo/Skills/tree/HEAD/agent-skills/web-design/cinematic-gsap-lenis-motion-system

Perguntar na sua IA favorita

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

Prévia

Do README da skill

Skills preview

Documentação

Sistema de Movimento Cinemático com GSAP e Lenis

Quando Usar

  • Quando o site precisa de uma linguagem de movimento premium completa, não apenas uma animação isolada.
  • Rolagem suave, revelações, cenas fixas, parallax, movimento de hover e comportamento do cursor devem parecer conectados.
  • A sensação alvo é editorial de luxo, polimento no nível Apple, portfólio de estúdio criativo ou narrativa cinematográfica imersiva.
  • A stack pode usar GSAP, ScrollTrigger e Lenis.

Estilo de Movimento

  • Suave, elegante, ligeiramente atrasado e intencional.
  • Movimento escalonado deve guiar a ordem de leitura.
  • Movimento em camadas deve criar profundidade sem sobrecarregar a interface.
  • ScrollTrigger deve iniciar as cenas quando elas entram no viewport, não reagir a cada pequena rolagem.
  • Prefira sutileza à intensidade.

Evitar:

  • Movimento quicado, elástico, com mola ou divertido.
  • Transições abruptas e rápidas.
  • Grandes saltos de escala.
  • UI superanimada.
  • Efeitos chamativos de estilo gamer.

Tokens Base

  • Eases: power3.out, power4.out, expo.out.
  • Scroll scrub: scrub: 0.8 a 1.4 para atraso cinematográfico.
  • Revelações: 0.75s a 1.1s.
  • Hover: 0.35s a 0.6s.
  • Atraso do cursor: 0.25s a 0.45s.
  • Stagger de texto: palavras 0.035s a 0.07s, linhas 0.08s a 0.14s.
  • Stagger de cartões: 0.06s a 0.1s.
  • Gatilho de revelação: start: "top 82%".
  • Handoff de pin: anticipatePin: 1.

Configuração

Instale:

npm i gsap lenis

Inicialize uma vez, após o DOM existir. O Lenis conduz seu RAF através do ticker do GSAP para que ScrollTrigger e rolagem suave permaneçam sincronizados.

import Lenis from "lenis";
import "lenis/dist/lenis.css";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";

gsap.registerPlugin(ScrollTrigger);
gsap.defaults({ ease: "power3.out", duration: 0.85 });

const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;

let lenis;

if (!reduceMotion) {
  lenis = new Lenis({
    lerp: 0.08,
    smoothWheel: true,
    wheelMultiplier: 0.9,
    anchors: true,
  });

  lenis.on("scroll", ScrollTrigger.update);

  gsap.ticker.add((time) => {
    lenis.raf(time * 1000);
  });

  gsap.ticker.lagSmoothing(0);
}

window.addEventListener("load", () => {
  ScrollTrigger.refresh();
});

API de Marcação

Use pequenos atributos de dados para que o sistema de movimento possa ser reutilizado em várias páginas.

<h1 data-motion-text="lines">Produtos digitais com contenção cinematográfica.</h1>
<p data-motion-text="words">Cada interação deve parecer deliberada.</p>

<section data-reveal-group>
  <article data-reveal="fade-up" data-reveal-item>...</article>
  <article data-reveal="fade-up" data-reveal-item>...</article>
</section>

<figure data-image-reveal data-parallax-section>
  <img data-parallax-image src="/studio.jpg" alt="">
</figure>

<a data-magnetic data-cursor-label="Explorar" href="/work">Explorar</a>
<div data-cursor><span data-cursor-label></span></div>

Base CSS

html.has-motion [data-motion-text],
html.has-motion [data-reveal],
html.has-motion [data-reveal-item],
html.has-motion [data-image-reveal] {
  visibility: hidden;
}

.motion-line-mask,
.motion-word-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.motion-line,
.motion-word {
  display: inline-block;
  will-change: transform, opacity, filter;
}

[data-image-reveal] {
  overflow: hidden;
}

[data-parallax-image] {
  display: block;
  width: 100%;
  height: 115%;
  object-fit: cover;
  will-change: transform;
}

[data-cursor] {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  mix-blend-mode: difference;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce), (pointer: coarse) {
  [data-cursor] {
    display: none;
  }
}

Revelações de Texto Escalonado

Use containers mascarados para texto premium. Prefira wrappers de linha manuais quando as quebras de linha exatas forem importantes. Use a divisão de palavras para texto responsivo flexível.

document.documentElement.classList.add("has-motion");

function splitWords(element) {
  if (element.dataset.motionSplit === "true") return;

  const text = element.textContent || "";
  const parts = text.split(/(\s+)/);

  element.textContent = "";
  element.setAttribute("aria-label", text.trim());

  let index = 0;
  parts.forEach((part) => {
    if (!part.trim()) {
      element.appendChild(document.createTextNode(part));
      return;
    }

    const mask = document.createElement("span");
    const word = document.createElement("span");

    mask.className = "motion-word-mask";
    mask.setAttribute("aria-hidden", "true");
    word.className = "motion-word";
    word.textContent = part;
    word.style.setProperty("--word-index", index);

    mask.appendChild(word);
    element.appendChild(mask);
    index += 1;
  });

  element.dataset.motionSplit = "true";
}

function splitLines(element) {
  if (element.dataset.motionLineSplit === "true") return;
  if (element.querySelector(".motion-line")) return;

  const text = (element.textContent || "").trim();
  const lines = text.split(/\n+/).map((line) => line.trim()).filter(Boolean);
  if (lines.length < 2) return;

  element.textContent = "";
  element.setAttribute("aria-label", text);

  lines.forEach((line) => {
    const mask = document.createElement("span");
    const inner = document.createElement("span");

    mask.className = "motion-line-mask";
    mask.setAttribute("aria-hidden", "true");
    inner.className = "motion-line";
    inner.textContent = line;

    mask.appendChild(inner);
    element.appendChild(mask);
    element.appendChild(document.createTextNode(" "));
  });

  element.dataset.motionLineSplit = "true";
}

function initTextReveals() {
  if (reduceMotion) {
    gsap.set("[data-motion-text]", { autoAlpha: 1, clearProps: "all" });
    return;
  }

  gsap.utils.toArray("[data-motion-text='words']").forEach((element) => {
    splitWords(element);
    const words = element.querySelectorAll(".motion-word");

    gsap.set(element, { autoAlpha: 1 });
    gsap.fromTo(
      words,
      { yPercent: 110, autoAlpha: 0, filter: "blur(8px)" },
      {
        yPercent: 0,
        autoAlpha: 1,
        filter: "blur(0px)",
        duration: 0.9,
        ease: "power4.out",
        stagger: 0.055,
        scrollTrigger: {
          trigger: element,
          start: "top 82%",
          once: true,
        },
      }
    );
  });

  gsap.utils.toArray("[data-motion-text='lines']").forEach((element) => {
    splitLines(element);
    const lines = element.querySelectorAll(".motion-line");
    const targets = lines.length ? lines : element.children;

    gsap.set(element, { autoAlpha: 1 });
    gsap.fromTo(
      targets,
      { yPercent: 100, autoAlpha: 0, filter: "blur(8px)" },
      {
        yPercent: 0,
        autoAlpha: 1,
        filter: "blur(0px)",
        duration: 1,
        ease: "power4.out",
        stagger: 0.11,
        scrollTrigger: {
          trigger: element,
          start: "top 84%",
          once: true,
        },
      }
    );
  });
}

Marcação de linha quando as quebras de linha exatas forem importantes:

<h2 data-motion-text="lines">
  <span class="motion-line-mask"><span class="motion-line">Movimento cinematográfico</span></span>
  <span class="motion-line-mask"><span class="motion-line">com contenção editorial.</span></span>
</h2>

Revelações de Scroll

Crie um pequeno mapa de presets de revelação. Use autoAlpha, transformações e leve desfoque. Use desfoque com moderação em elementos grandes.

const revealPresets = {
  "fade-up": { from: { y: 32, autoAlpha: 0 }, to: { y: 0, autoAlpha: 1 } },
  "blur-in": { from: { y: 18, autoAlpha: 0, filter: "blur(10px)" }, to: { y: 0, autoAlpha: 1, filter: "blur(0px)" } },
  "scale": { from: { scale: 0.96, autoAlpha: 0 }, to: { scale: 1, autoAlpha: 1 } },
  "slide-left": { from: { x: 48, autoAlpha: 0 }, to: { x: 0, autoAlpha: 1 } },
  "slide-right": { from: { x: -48, autoAlpha: 0 }, to: { x: 0, autoAlpha: 1 } },
};

function initScrollReveals() {
  if (reduceMotion) {
    gsap.set("[data-reveal], [data-reveal-item]", { autoAlpha: 1, clearProps: "all" });
    return;
  }

  gsap.utils.toArray("[data-reveal-group]").forEach((group) => {
    const items = group.querySelectorAll("[data-reveal-item]");
    gsap.set(group, { autoAlpha: 1 });
    gsap.fromTo(
      items,
      { y: 36, autoAlpha: 0, filter: "blur(8px)" },
      {
        y: 0,
        autoAlpha: 1,
        filter: "blur(0px)",
        duration: 0.95,
        ease: "power4.out",
        stagger: 0.075,
        scrollTrigger: {
          trigger: group,
          start: "top 82%",
          once: true,
        },
      }
    );
  });

  gsap.utils.toArray("[data-reveal]:not([data-reveal-item])").forEach((element) => {
    const preset = revealPresets[element.dataset.reveal] || revealPresets["fade-up"];
    gsap.set(element, { autoAlpha: 1 });
    gsap.fromTo(element, preset.from, {
      ...preset.to,
      duration: 0.9,
      ease: "power4.out",
      delay: Number(element.dataset.revealDelay || 0),
      scrollTrigger: {
        trigger: element,
        start: "top 84%",
        once: true,
      },
    });
  });
}

Revelações de Imagem com Clipping

function initImageReveals() {
  if (reduceMotion) {
    gsap.set("[data-image-reveal]", { autoAlpha: 1, clipPath: "none" });
    return;
  }

  gsap.utils.toArray("[data-image-reveal]").forEach((figure) => {
    const image = figure.querySelector("img");
    gsap.set(figure, { autoAlpha: 1 });

    const tl = gsap.timeline({
      scrollTrigger: {
        trigger: figure,
        start: "top 82%",
        once: true,
      },
    });

    tl.fromTo(
      figure,
      { clipPath: "inset(0 0 100% 0)" },
      { clipPath: "inset(0 0 0% 0)", duration: 1.1, ease: "power4.out" }
    ).fromTo(
      image,
      { scale: 1.08, autoAlpha: 0.75 },
      { scale: 1, autoAlpha: 1, duration: 1.2, ease: "power4.out" },
      0
    );
  });
}

Movimento Parallax

Use diferenças de velocidade em vez de movimento dramático. Fundos se movem mais devagar que o conteúdo. Destaques em primeiro plano se movem ligeiramente mais rápido.

function initParallax() {
  if (reduceMotion) return;

  gsap.utils.toArray("[data-parallax-image], [data-parallax-layer]").forEach((layer) => {
    const speed = Number(layer.dataset.parallaxSpeed || 0.18);
    const section = layer.closest("[data-parallax-section]") || layer;

    gsap.to(layer, {
      y: () => window.innerHeight * speed * -1,
      ease: "none",
      scrollTrigger: {
        trigger: section,
        start: "top bottom",
        end: "bottom top",
        scrub: 1.2,
        invalidateOnRefresh: true,
      },
    });
  });
}

Seções de Scroll Fixas

Use seções fixas apenas para momentos de história. Mantenha o movimento sincronizado com o scroll linear, depois coloque tweens de revelação com easing dentro da cena.

function initHorizontalGalleries() {
  if (reduceMotion) return;

  gsap.utils.toArray("[data-horizontal-gallery]").forEach((section) => {
    const track = section.querySelector("[data-horizontal-track]");
    if (!track) return;

    gsap.to(track, {
      x: () => -(track.scrollWidth - window.innerWidth),
      ease: "none",
      scrollTrigger: {
        trigger: section,
        start: "top top",
        end: () => `+=${track.scrollWidth}`,
        scrub: 1,
        pin: true,
        anticipatePin: 1,
        invalidateOnRefresh: true,
      },
    });
  });
}

Padrão de storytelling fixo:

function initStoryScenes() {
  if (reduceMotion) return;

  gsap.utils.toArray("[data-story-scene]").forEach((scene) => {
    const panels = scene.querySelectorAll("[data-story-panel]");

    gsap.timeline({
      scrollTrigger: {
        trigger: scene,
        start: "top top",
        end: () => `+=${panels.length * window.innerHeight}`,
        scrub: 1.1,
        pin: true,
        anticipatePin: 1,
      },
    })
      .to(panels, { yPercent: -100 * (panels.length - 1), ease: "none" })
      .to(scene.querySelectorAll("[data-story-depth]"), { yPercent: -16, ease: "none" }, 0);
  });
}

Interações Premium de Hover

Use quickTo do GSAP para movimento magnético, para que o hover siga o ponteiro sem recriar tweens a cada evento.

function initMagnetic() {
  if (reduceMotion || window.matchMedia("(pointer: coarse)").matches) return;

  gsap.utils.toArray("[data-magnetic]").forEach((element) => {
    const strength = Number(element.dataset.magnetic || 0.18);
    const xTo = gsap.quickTo(element, "x", { duration: 0.45, ease: "power3.out" });
    const yTo = gsap.quickTo(element, "y", { duration: 0.45, ease: "power3.out" });

    element.addEventListener("pointermove", (event) => {
      const rect = element.getBoundingClientRect();
      const x = (event.clientX - rect.left - rect.width / 2) * strength;
      const y = (event.clientY - rect.top - rect.height / 2) * strength;

      xTo(x);
      yTo(y);
    });

    element.addEventListener("pointerleave", () => {
      xTo(0);
      yTo(0);
    });
  });
}

Receitas de hover:

  • Botões magnéticos: translação apenas em x/y, mantenha a escala abaixo de 1.03.
  • Cartões magnéticos: adicione rotateX/rotateY abaixo de 4deg.
  • Zoom de imagem: scale: 1 para 1.06, duração 0.7s, ease power3.out.
  • Escala de cinza para cor: faça a transição do filtro apenas em mídias pequenas/médias.
  • Setas animadas: mova o ícone x: 0 para x: 6, fade da seta duplicada.
  • Hover direcional: calcule o lado de entrada do ponteiro, mas mantenha o movimento abaixo de 16px.

Cursor Personalizado

Use um seguidor de cursor como atmosfera, não como decoração. Esconda-o em dispositivos de toque.

function initCursor() {
  if (reduceMotion || window.matchMedia("(pointer: coarse)").matches) return;

  const cursor = document.querySelector("[data-cursor]");
  if (!cursor) return;

  const label = cursor.querySelector("[data-cursor-label]");
  const xTo = gsap.quickTo(cursor, "x", { duration: 0.35, ease: "power3.out" });
  const yTo = gsap.quickTo(cursor, "y", { duration: 0.35, ease: "power3.out" });

  document.addEventListener("pointermove", (event) => {
    xTo(event.clientX);
    yTo(event.clientY);
  });

  gsap.utils.toArray("[data-cursor-label]")

Inicialização

Chame todas as funções após o carregamento inicial do DOM e após cada atualização de rota (SPA).

function initMotion() {
  initTextReveals();
  initScrollReveals();
  initImageReveals();
  initParallax();
  initHorizontalGalleries();
  initStoryScenes();
  initMagnetic();
  initCursor();
}

Cleanup

Em SPA, sempre mate as animações e destrua as instâncias do ScrollTrigger ao sair de uma rota.

function cleanupMotion() {
  ScrollTrigger.getAll().forEach((st) => st.kill());
  gsap.killTweensOf("*");
}

Resumo da Estrutura do Projeto

  • initMotion() para iniciar tudo após o DOM estar pronto.
  • cleanupMotion() para redefinir tudo ao trocar de rota.
  • Data attributes orientam a lógica sem classes CSS fixas.
  • Presets de ease e stagger mantêm uma sensação de movimento consistente.
  • Suporte a prefers-reduced-motion e detecção de toque.
  • Sem dependências de framework, funciona com qualquer estrutura (React, Vue, Shopify, WordPress).

Individual skills in this repo

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

MengTo/Skills

Create polished 60 fps 4:3 4K browser screen-recording style videos from Codex in-app browser captures, with browser-only crop, natural macOS cursor styling, deliberate click choreography, zoom-follow framing, ffprobe/thumbnail verification, and optional native recording compatibility checks. Use when the user asks to record or re-record browser actions, show cursor clicks and zooms, make Dribbble/UI inspiration or product demo recordings, or asks whether Codex, Playwright, or an MCP can produce a natural browser demo video.

MengTo/Skills

Generate ElevenLabs text-to-speech audio from scripts or inline text using local voice profiles. Use when the user asks for ElevenLabs, text-to-speech, TTS, narration, voiceover, speech audio, or voice generation; load voice names, voice ids, emails, owners, and account-specific defaults only from local config outside the skill.

MengTo/Skills

Profile, audit, and optimize frontend page performance with emphasis on animation work, memory-leak risks, long-session slowdowns, CSS animations, canvas/WebGL requestAnimationFrame loops, marquees, skeletons, GSAP/Three/Matter effects, timers, listeners, and observers. Use when the user asks to make animations performant, pause offscreen animations, look for memory leaks, profile pages that slow the computer over time, fix janky scrolling, reduce CPU/GPU use, or repeat the "only play in view" optimization on React/Vite/Next/frontend pages using Codex Browser.

MengTo/Skills

Turn a reference video into a super detailed recreation or inspiration prompt. Use when the user provides, mentions, uploads, links, or points to a video and asks to analyze the design, UI, animations, transitions, scroll interactions, typography, colors, assets, WebGL/Three.js, storytelling, section-by-section behavior, or to create a prompt/article that recreates the page, app, interaction, or motion system.

MengTo/Skills

Create an on-scroll animation trigger using IntersectionObserver with Tailwind-friendly animation classes and keyframes. Use when asked for scroll-reveal, animate-on-scroll, or sequencing element animations when they enter the viewport.

MengTo/Skills

Use when designing or implementing product-grade web motion like Stripe, Linear, Apple, and Vercel. Covers motion principles, easing/duration defaults, choreography patterns, scroll/hover interactions, performance, accessibility (reduced motion), and implementation guidance.

MengTo/Skills

Create cinematic scroll-driven landing pages with Lenis smooth scrolling, GSAP ScrollTrigger, scroll-linked progression, staggered text reveals, sticky card stacks, parallax backgrounds, scroll-scrubbed transitions, footer reveals, and immersive preloaders. Use when analyzing or building premium editorial scroll experiences, sticky project stacks, kinetic typography, or section-by-section storytelling.

MengTo/Skills

Use when designing or rewriting a high-converting SaaS pricing page (structure, plan design, copywriting, SEO/AEO, FAQs, layout patterns, experiments). Includes checklists, templates, and common pitfalls.

MengTo/Skills

Use when creating or refining WebGL-heavy landing pages and you need to steer toward a specific visual outcome (premium, technical, playful, cinematic) while balancing conversion clarity, performance, and implementation complexity.

Habilidades Relacionadas