AGENT SKILL

gsap

Build high-performance web animations with GSAP (GreenSock Animation Platform) — tweens, timelines, ScrollTrigger, Flip, MorphSVG, SplitText, and physics. Use when implementing fluid transitions, scroll animations, SVG effects, or complex interactive motion.

License 许可
MIT
所属仓库
siddu1004/SFP
最近更新
2026-11-09
Stars
★ 5
Forks
0

01 前言 Front Matter

name
gsap
description
Build high-performance web animations with GSAP (GreenSock Animation Platform) — tweens, timelines, ScrollTrigger, Flip, MorphSVG, SplitText, and physics. Use when implementing fluid transitions, scroll animations, SVG effects, or complex interactive motion.

03 SKILL.md 正文

GSAP (GreenSock Animation Platform)

High-performance, battle-tested JavaScript animation library for modern web applications.

Core Concepts

1. Basic Tweens

import gsap from 'gsap';

// Move to target state
gsap.to('.card', {
  x: 100,
  opacity: 1,
  duration: 0.8,
  ease: 'power2.out'
});

// Animate from initial state
gsap.from('.hero-title', {
  y: 50,
  opacity: 0,
  duration: 1,
  ease: 'back.out(1.7)'
});

2. Timelines (Choreographed Sequences)

Avoid setTimeout or nested callbacks. Use Timelines for sequenced animations:

const tl = gsap.timeline({ defaults: { ease: 'power3.out', duration: 0.6 } });

tl.from('.badge', { scale: 0, opacity: 0 })
  .from('.heading', { y: 30, opacity: 0 }, '-=0.3')
  .from('.description', { y: 20, opacity: 0 }, '-=0.2')
  .from('.cta-button', { scale: 0.9, opacity: 0 }, '-=0.2');

3. ScrollTrigger

import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);

gsap.to('.parallax-layer', {
  yPercent: -50,
  ease: 'none',
  scrollTrigger: {
    trigger: '.section',
    start: 'top bottom',
    end: 'bottom top',
    scrub: true
  }
});

4. Hardware Acceleration & Best Practices

  • Animate transform (x, y, scale, rotation) and opacity rather than top, left, width, or height.
  • Use gsap.context() in React (useLayoutEffect or useEffect) to ensure clean teardown and prevent memory leaks.
  • Leverage ScrollTrigger.refresh() after dynamic DOM or image loads.

04 同仓库更多 Skills

siddu1004
siddu1004/SFP

scientific-schematics

Generates scientific diagram drafts using Nano Banana 2 AI with smart iterative refinement. Uses Gemini 3.7 Flash for quality review. Refines when the review requests improvement, with at most two generations. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.

★ 5
siddu1004
siddu1004/SFP

polyhaven-texture-apply

Apply realistic PBR textures from PolyHaven to any Blender object. Supports metals, wood, concrete, fabric, and more. Trigger when asked to texture an object, apply a material from PolyHaven, make something look like metal/wood/marble, or change object surface.

★ 5
siddu1004
siddu1004/SFP

polyhaven-studio-setup

Set up a professional product photography studio in Blender using PolyHaven HDRIs and PBR ground materials. Trigger when asked to create a studio setup, add HDRI lighting, set up product photography, or create a showroom scene.

★ 5
siddu1004
siddu1004/SFP

polyhaven-scene-builder

Build complete product scenes using PolyHaven assets — HDRI environment, textured ground/pedestal, and optional props from the 3D model library. Trigger when asked to build a product scene, create a showcase setup, add a pedestal, or compose a product shot.

★ 5
siddu1004
siddu1004/SFP

polyhaven-material-swap

Cycle through multiple PolyHaven materials on a product and render each variant. Great for showing color/finish options. Trigger when asked to show material variants, swap textures, create color options, show finish comparisons, or render product in different materials.

★ 5
siddu1004
siddu1004/SFP

polyhaven-hdri-showcase

Render the same product across multiple HDRI environments and output a comparison grid. Trigger when asked to compare lighting setups, test different environments, show product in multiple settings, or create an HDRI comparison.

★ 5