Skip to content

Commit 85c1e07

Browse files
committed
fix: address review comments for gsap-framer-scroll-animation skill
1 parent dbc05e5 commit 85c1e07

4 files changed

Lines changed: 28 additions & 20 deletions

File tree

‎docs/README.skills.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to
152152
| [github-copilot-starter](../skills/github-copilot-starter/SKILL.md) | Set up complete GitHub Copilot configuration for a new project based on technology stack | None |
153153
| [github-issues](../skills/github-issues/SKILL.md) | Create, update, and manage GitHub issues using MCP tools. Use this skill when users want to create bug reports, feature requests, or task issues, update existing issues, add labels/assignees/milestones, set issue fields (dates, priority, custom fields), set issue types, manage issue workflows, link issues, add dependencies, or track blocked-by/blocking relationships. Triggers on requests like "create an issue", "file a bug", "request a feature", "update issue X", "set the priority", "set the start date", "link issues", "add dependency", "blocked by", "blocking", or any GitHub issue management task. | `references/dependencies.md`<br />`references/images.md`<br />`references/issue-fields.md`<br />`references/issue-types.md`<br />`references/projects.md`<br />`references/search.md`<br />`references/sub-issues.md`<br />`references/templates.md` |
154154
| [go-mcp-server-generator](../skills/go-mcp-server-generator/SKILL.md) | Generate a complete Go MCP server project with proper structure, dependencies, and implementation using the official github.com/modelcontextprotocol/go-sdk. | None |
155-
| [gsap-framer-scroll-animation](../skills/gsap-framer-scroll-animation/SKILL.md) | 'Use this skill whenever the user wants to build scroll animations, scroll effects, parallax, scroll-triggered reveals, pinned sections, horizontal scroll, text animations, or any motion tied to scroll position — in vanilla JS, React, or Next.js. Covers GSAP ScrollTrigger (pinning, scrubbing, snapping, timelines, horizontal scroll, ScrollSmoother, matchMedia) and Framer Motion / Motion v12 (useScroll, useTransform, useSpring, whileInView, variants). Use this skill even if the user just says "animate on scroll", "fade in as I scroll", "make it scroll like Apple", "parallax effect", "sticky section", "scroll progress bar", or "entrance animation". Also triggers for Copilot prompt patterns for GSAP or Framer Motion code generation. Pairs with the premium-frontend-ui skill for creative philosophy and design-level polish.' | `references/framer.md`<br />`references/gsap.md` |
155+
| [gsap-framer-scroll-animation](../skills/gsap-framer-scroll-animation/SKILL.md) | Use this skill whenever the user wants to build scroll animations, scroll effects, parallax, scroll-triggered reveals, pinned sections, horizontal scroll, text animations, or any motion tied to scroll position — in vanilla JS, React, or Next.js. Covers GSAP ScrollTrigger (pinning, scrubbing, snapping, timelines, horizontal scroll, ScrollSmoother, matchMedia) and Framer Motion / Motion v12 (useScroll, useTransform, useSpring, whileInView, variants). Use this skill even if the user just says "animate on scroll", "fade in as I scroll", "make it scroll like Apple", "parallax effect", "sticky section", "scroll progress bar", or "entrance animation". Also triggers for Copilot prompt patterns for GSAP or Framer Motion code generation. Pairs with the premium-frontend-ui skill for creative philosophy and design-level polish. | `references/framer.md`<br />`references/gsap.md` |
156156
| [gtm-0-to-1-launch](../skills/gtm-0-to-1-launch/SKILL.md) | Launch new products from idea to first customers. Use when launching products, finding early adopters, building launch week playbooks, diagnosing why adoption stalls, or learning that press coverage does not equal growth. Includes the three-layer diagnosis, the 2-week experiment cycle, and the launch that got 50K impressions and 12 signups. | None |
157157
| [gtm-ai-gtm](../skills/gtm-ai-gtm/SKILL.md) | Go-to-market strategy for AI products. Use when positioning AI products, handling "who is responsible when it breaks" objections, pricing variable-cost AI, choosing between copilot/agent/teammate framing, or selling autonomous tools into enterprises. | None |
158158
| [gtm-board-and-investor-communication](../skills/gtm-board-and-investor-communication/SKILL.md) | Board meeting preparation, investor updates, and executive communication. Use when preparing board decks, writing investor updates, handling bad news with the board, structuring QBRs, or building board-level metric discipline. Includes the "Three Things" narrative model, the 4-tier metric hierarchy, and the pre-brief pattern that prevents board surprises. | None |

‎skills/gsap-framer-scroll-animation/SKILL.md‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: gsap-framer-scroll-animation
33
description: >-
4-
'Use this skill whenever the user wants to build scroll animations, scroll effects,
4+
Use this skill whenever the user wants to build scroll animations, scroll effects,
55
parallax, scroll-triggered reveals, pinned sections, horizontal scroll, text animations,
66
or any motion tied to scroll position — in vanilla JS, React, or Next.js.
77
Covers GSAP ScrollTrigger (pinning, scrubbing, snapping, timelines, horizontal scroll,
@@ -10,7 +10,7 @@ description: >-
1010
"animate on scroll", "fade in as I scroll", "make it scroll like Apple",
1111
"parallax effect", "sticky section", "scroll progress bar", or "entrance animation".
1212
Also triggers for Copilot prompt patterns for GSAP or Framer Motion code generation.
13-
Pairs with the premium-frontend-ui skill for creative philosophy and design-level polish.'
13+
Pairs with the premium-frontend-ui skill for creative philosophy and design-level polish.
1414
---
1515

1616
# GSAP & Framer Motion — Scroll Animations Skill
@@ -19,7 +19,7 @@ Production-grade scroll animations with GitHub Copilot prompts, ready-to-use cod
1919

2020
> **Design Companion:** This skill provides the *technical implementation* for scroll-driven motion.
2121
> For the *creative philosophy*, design principles, and premium aesthetics that should guide **how**
22-
> and **when** to animate, always cross-reference the [premium-frontend-ui](../premium-frontend-ui/SKILL.md) skill.
22+
> and **when** to animate, always cross-reference the **premium-frontend-ui** skill.
2323
> Together they form a complete approach: premium-frontend-ui decides the **what** and **why**;
2424
> this skill delivers the **how**.
2525
@@ -60,6 +60,14 @@ import { motion, useScroll, useTransform, useSpring } from 'motion/react';
6060
// legacy: import { motion } from 'framer-motion' — also valid
6161
```
6262

63+
## Workflow
64+
65+
1. Interpret the user's intent to identify if GSAP or Framer Motion is the best fit.
66+
2. Read the relevant reference document in `references/` for detailed APIs and patterns.
67+
3. Suggest the required package installation if not already present.
68+
4. Implement the scaffold for the animation structure, adhering to the requested format (React components, hook requirements, or vanilla JS).
69+
5. Apply the correct tools (scrolling vs in-view elements) ensuring accessibility options are present and hooks don't cause infinite re-renders.
70+
6371
## The 5 Most Common Scroll Patterns
6472

6573
Quick reference — full recipes with Copilot prompts are in the reference files.
@@ -115,7 +123,7 @@ tl.from('.title', { opacity: 0, y: 60 }).from('.img', { scale: 0.85 });
115123
- **Framer Next.js**: always add `'use client'` at top of any file using motion hooks
116124
- **Both**: animate only `transform` and `opacity` — avoid `width`, `height`, `box-shadow`
117125
- **Accessibility**: always check `prefers-reduced-motion` — see each reference file for patterns
118-
- **Premium polish**: follow the [premium-frontend-ui](../premium-frontend-ui/SKILL.md) principles for motion timing, easing curves, and restraint — animation should enhance, never overwhelm
126+
- **Premium polish**: follow the **premium-frontend-ui** skill principles for motion timing, easing curves, and restraint — animation should enhance, never overwhelm
119127

120128
## Copilot Prompting Tips
121129

@@ -136,4 +144,4 @@ tl.from('.title', { opacity: 0, y: 60 }).from('.img', { scale: 0.85 });
136144

137145
| Skill | Relationship |
138146
|---|---|
139-
| [premium-frontend-ui](../premium-frontend-ui/SKILL.md) | Creative philosophy, design principles, and aesthetic guidelines — defines *when* and *why* to animate |
147+
| **premium-frontend-ui** | Creative philosophy, design principles, and aesthetic guidelines — defines *when* and *why* to animate |

‎skills/gsap-framer-scroll-animation/references/framer.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ export function ParallaxSection() {
282282
return (
283283
<section ref={ref} className="relative h-screen overflow-hidden flex items-center justify-center">
284284
<motion.div
285-
style={{ y: backgroundY, scale: 1.2 }}
286285
className="absolute inset-0 bg-cover bg-center"
287286
style={{ backgroundImage: 'url(/hero-bg.jpg)', y: backgroundY, scale: 1.2 }}
288287
/>
@@ -406,19 +405,21 @@ Animate y, backgroundColor, boxShadow with motion.nav.
406405

407406
```tsx
408407
'use client';
409-
import { useState } from 'react';
408+
import { useRef, useState } from 'react';
410409
import { motion, useScroll, useMotionValueEvent } from 'motion/react';
411410

412411
export function Navbar() {
413412
const { scrollY } = useScroll();
414413
const [scrolled, setScrolled] = useState(false);
415414
const [hidden, setHidden] = useState(false);
416-
const [prev, setPrev] = useState(0);
415+
const prevRef = useRef(0);
417416

418417
useMotionValueEvent(scrollY, 'change', latest => {
419-
setScrolled(latest > 80);
420-
setHidden(latest > prev && latest > 200);
421-
setPrev(latest);
418+
const nextScrolled = latest > 80;
419+
const nextHidden = latest > prevRef.current && latest > 200;
420+
setScrolled(current => (current === nextScrolled ? current : nextScrolled));
421+
setHidden(current => (current === nextHidden ? current : nextHidden));
422+
prevRef.current = latest;
422423
});
423424

424425
return (

‎skills/gsap-framer-scroll-animation/references/gsap.md‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,13 @@ gsap.to('.element', {
5858
trigger: '.section', // Element whose position triggers the animation
5959
start: 'top 80%', // "[trigger edge] [viewport edge]"
6060
end: 'bottom 20%', // Where animation ends
61-
scrub: true, // Link progress to scroll (true = instant)
62-
scrub: 1, // Smooth scrub with 1s lag
63-
pin: true, // Pin trigger element during scroll
64-
pin: '.other-element', // Pin a different element
61+
scrub: 1, // Link progress to scroll; use true for instant scrub, or a number for smooth lag
62+
pin: true, // Pin trigger element during scroll; use a selector/element to pin something else
6563
pinSpacing: true, // Add space below pinned element (default: true)
6664
markers: true, // Debug markers — REMOVE in production
6765
toggleActions: 'play none none reverse', // onEnter onLeave onEnterBack onLeaveBack
6866
toggleClass: 'active', // CSS class added/removed when active
69-
snap: 1, // Snap to nearest end position
70-
snap: { snapTo: 'labels', duration: 0.3, ease: 'power1.inOut' },
67+
snap: { snapTo: 'labels', duration: 0.3, ease: 'power1.inOut' }, // Or use a number like 1 to snap to increments
7168
fastScrollEnd: true, // Force completion if user scrolls past fast
7269
horizontal: false, // true for horizontal scroll containers
7370
anticipatePin: 1, // Reduces pin jump (seconds to anticipate)
@@ -574,18 +571,20 @@ Destroy lenis on unmount if in React.
574571

575572
```js
576573
import Lenis from 'lenis';
574+
import { useEffect } from 'react';
577575

578576
const lenis = new Lenis({ duration: 1.2, smoothWheel: true });
579577

580-
gsap.ticker.add(time => lenis.raf(time * 1000));
578+
const raf = (time) => lenis.raf(time * 1000);
579+
gsap.ticker.add(raf);
581580
gsap.ticker.lagSmoothing(0);
582581
lenis.on('scroll', ScrollTrigger.update);
583582

584583
// React cleanup
585584
useEffect(() => {
586585
return () => {
587586
lenis.destroy();
588-
gsap.ticker.remove(lenis.raf);
587+
gsap.ticker.remove(raf);
589588
};
590589
}, []);
591590
```

0 commit comments

Comments
 (0)