gsap-in-react

gsap-in-react is a cursor rule for Cursor from dmenchaca/webflow-to-react. It costs 0 tokens per session (901 once invoked), scanned A, original, MIT.

A React coding rule for GSAP, a JavaScript animation library, when preserving animations from a Webflow export. It places animation setup in React's effect lifecycle and cleans it up when the component is removed.

In plain words
What is it for?
Use it when moving Webflow GSAP animations into React components, including animations that use ScrollTrigger or SplitText.
Why use it?
It keeps animations scoped to the intended component and prevents leftover animations, scroll triggers, or styles from accumulating.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when moving Webflow GSAP animations into React components, including animations that use ScrollTrigger or SplitText.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/dmenchaca/webflow-to-react/gsap-in-react
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/dmenchaca/webflow-to-react

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gsap-in-react

README.md
[![agentmods](https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/gsap-in-react/github.svg)](https://agentmods.dev/rules/dmenchaca/webflow-to-react/gsap-in-react)
Your own site
<a href="https://agentmods.dev/rules/dmenchaca/webflow-to-react/gsap-in-react"><img src="https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/gsap-in-react/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gsap-in-react

Your own site · 80×15
<a href="https://agentmods.dev/rules/dmenchaca/webflow-to-react/gsap-in-react"><img src="https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/gsap-in-react.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 901 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00901
Opus 5.5 $0.00000 $0.00360
Sonnet 5.5 $0.00000 $0.00180
Haiku 4.5 $0.00000 $0.00090

Measured 3mo ago against content hash dbfd04a6a87f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

gsap-in-react scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/gsap-in-react.mdc · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GSAP in React (keep the Webflow animations intact)

This project migrated from a Webflow export that uses GSAP (and sometimes ScrollTrigger/SplitText). The migration strategy is: keep those animations as-is, just wrap initialization in React's lifecycle. Do NOT rewrite them in Framer Motion.

Core pattern: gsap.context() inside useEffect

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

export function HeroSection() {
  const scopeRef = useRef<HTMLDivElement>(null)

  useEffect(() => {
    const ctx = gsap.context(() => {
      gsap.from('.hero-title', { y: 40, opacity: 0, duration: 1 })
      gsap.to('.hero-cta', { scale: 1.05, yoyo: true, repeat: -1 })
    }, scopeRef)

    return () => ctx.revert()
  }, [])

  return <div ref={scopeRef}>…</div>
}

Why gsap.context():

  • Scopes selectors to scopeRef so .hero-title doesn't match elsewhere on the page.
  • ctx.revert() kills every tween, removes every ScrollTrigger, and restores inline styles on unmount. One line, no leaks.
  • Safe under React 19 StrictMode's double-effect invocation (revert undoes the first run cleanly).

ScrollTrigger

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

gsap.registerPlugin(ScrollTrigger)

export function Section() {
  const ref = useRef<HTMLDivElement>(null)
  useEffect(() => {
    const ctx = gsap.context(() => {
      gsap.from('.reveal', {
        y: 60, opacity: 0, duration: 0.8,
        scrollTrigger: { trigger: '.reveal', start: 'top 80%' },
      })
    }, ref)
    return () => ctx.revert()
  }, [])
  return <div ref={ref}>…</div>
}

After route changes, async content loads, or layout shifts, call ScrollTrigger.refresh().

Rules

Do

  • Initialize GSAP inside useEffect, never during render.
  • Use gsap.context(fn, scopeRef) so selectors are scoped and cleanup is one call.
  • Return () => ctx.revert() from every effect that touches GSAP.
  • Register plugins once at module scope: gsap.registerPlugin(ScrollTrigger).
  • For reusable global animations (hero reveals, marquee), consider a hook: useHeroAnimations(containerRef) wired in MarketingSiteRoot.

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 93 lines · 0 tokens per session scan A dbfd04a6a87f

Subscribe to this mod's changes

gsap-in-react is a cursor rule published in the GitHub repository dmenchaca/webflow-to-react (26 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 901 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

gsap-in-react compared with cursor rules from other repositories

gsap-in-react next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
gsap-in-reactdmenchaca/webflow-to-reactCursor rule265mo agoMITA0Cursor
test-file-locationJNTMTMTM/eIslandCursor rule362todayGPL-3.0A144Cursor
react-componentsbishopZ/2026-BoilerplateCursor rule254mo agoMITA0Cursor
CreateStorybookStoriesjhancock532/bristol-social-groupsCursor rule69d agononeA18Cursor
NewComponentjhancock532/bristol-social-groupsCursor rule69d agononeA16Cursor
windsurfrulesAPIParkLab/APIParkCursor rule1.8k1mo agoApache-2.0A521Windsurf
tanstack-start-guidejahands/promptsCursor rule191mo agoMITA17Cursor