Skip to content

Sangram03/GSAP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

Perfect πŸ’₯ β€” you’ve added the official GSAP docs link (https://gsap.com/). Let’s now expand it with detailed GSAP documentation info, including official sections, usage guides, and hidden gems many developers miss.

Here’s the comprehensive GSAP documentation breakdown πŸ‘‡


🧭 GSAP β€” GreenSock Animation Platform

πŸ“˜ Official Docs β†’ https://gsap.com/docs/


βš™οΈ 1. Core GSAP Library

GSAP’s core module handles all the basic animations. Once you import or include it, you can use these main methods:

Method Description Example
gsap.to() Animates target properties to new values gsap.to(".box", { x: 200, duration: 1 });
gsap.from() Animates from starting values to current ones gsap.from(".circle", { opacity: 0, y: -50 });
gsap.fromTo() Defines both start and end values gsap.fromTo(".card", { scale: 0.5 }, { scale: 1 });
gsap.set() Instantly sets a property (no animation) gsap.set(".text", { opacity: 0 });
gsap.delayedCall() Calls a function after delay gsap.delayedCall(2, () => console.log("Done"));
gsap.killTweensOf() Instantly stops any ongoing animation gsap.killTweensOf(".box");

πŸ“„ Docs Link: πŸ‘‰ GSAP Core Methods


🎬 2. Timeline β€” Sequence Animations

Timelines give you precise control to chain and organize multiple animations.

const tl = gsap.timeline({ repeat: 2, yoyo: true });

tl.to(".box", { x: 100, duration: 1 })
  .to(".circle", { y: 100, duration: 1 })
  .to(".triangle", { rotation: 360, duration: 1 });
Method Description
tl.add() Add a new animation to the timeline
tl.play() Play animation forward
tl.reverse() Play backward
tl.pause() Pause animation
tl.seek(time) Jump to specific time
tl.progress(value) Set timeline progress (0 β†’ 1)

πŸ“„ Docs Link: πŸ‘‰ GSAP Timeline Docs


🧩 3. Plugins

GSAP includes official plugins that extend functionality β€” these are the real power tools πŸ”§

Plugin Purpose Docs Link
ScrollTrigger Trigger animations during scroll ScrollTrigger Docs
Draggable Make elements draggable Draggable Docs
MotionPathPlugin Move elements along SVG paths MotionPath Docs
ScrollToPlugin Smoothly scroll to positions ScrollTo Docs
SplitText Animate characters/words separately SplitText Docs
Observer Detect gestures (scroll, touch, wheel) Observer Docs
Flip Create advanced layout transitions Flip Docs

🧠 4. Utility Functions

GSAP comes with super-useful utility helpers via gsap.utils.

Utility Description Example
gsap.utils.random(min, max) Returns a random number gsap.utils.random(-50, 50)
gsap.utils.wrap(array) Cycles through values gsap.utils.wrap(["red","green","blue"])
gsap.utils.clamp(min, max, value) Limits value between range gsap.utils.clamp(0, 100, 120)
gsap.utils.interpolate(a, b, progress) Interpolates between values gsap.utils.interpolate(0, 100, 0.5)
gsap.utils.snap(increment, value) Snaps to nearest increment gsap.utils.snap(5, 17)

πŸ“„ Docs Link: πŸ‘‰ GSAP Utilities


πŸ•ΉοΈ 5. Eases β€” Motion Styles

Eases define how your animation moves.

Ease Name Effect
power1.inOut Smooth start and end
back.out(1.7) Overshoot at end
elastic.out(1, 0.3) Bouncy motion
bounce.out Ball drop bounce
sine.inOut Gentle wave-like motion

πŸ“„ Docs Link: πŸ‘‰ Easing Docs


🧠 6. Callbacks & Events

You can run code at specific points during an animation:

Callback Trigger Point
onStart When animation begins
onUpdate Every frame during animation
onComplete When animation finishes
onRepeat When animation repeats
onReverseComplete When reverse animation completes

Example:

gsap.to(".box", {
  x: 200,
  duration: 2,
  onStart: () => console.log("Started"),
  onComplete: () => console.log("Completed")
});

πŸ“„ Docs Link: πŸ‘‰ Callbacks Docs


βš›οΈ 7. GSAP in React / Next.js

When using GSAP in React, wrap animations in gsap.context() for cleanup and scope safety:

import { useEffect, useRef } from "react";
import { gsap } from "gsap";

export default function Example() {
  const boxRef = useRef();

  useEffect(() => {
    const ctx = gsap.context(() => {
      gsap.to(boxRef.current, { x: 300, duration: 2 });
    });
    return () => ctx.revert(); // cleanup on unmount
  }, []);

  return <div ref={boxRef} className="box"></div>;
}

πŸ“„ Docs Link: πŸ‘‰ React Integration Docs


🎨 8. CodePen Learning Playground

The GSAP team provides live interactive examples on CodePen:

πŸ‘‰ GSAP CodePen Collection Learn via hands-on demos (ScrollTrigger, MotionPath, Flip, etc.)


πŸ’Ž 9. GSAP Club (Premium Plugins)

GSAP has premium (paid) plugins via Club GreenSock:

  • MorphSVGPlugin πŸŒ€ β€” morph SVG paths
  • DrawSVGPlugin ✏️ β€” draw SVG strokes
  • SplitText πŸ’¬ β€” animate individual letters
  • GSDevTools βš™οΈ β€” debug timelines visually

πŸ“„ Docs Link: πŸ‘‰ Club GreenSock


πŸ”— Summary Table

Category Docs Link
GSAP Core https://gsap.com/docs/v3/GSAP/
Timeline https://gsap.com/docs/v3/GSAP/Timeline/
Plugins https://gsap.com/docs/v3/Plugins/
Eases https://gsap.com/docs/v3/Eases/
Utilities https://gsap.com/docs/v3/GSAP/UtilityMethods/
ScrollTrigger https://gsap.com/docs/v3/Plugins/ScrollTrigger/
React Integration https://gsap.com/resources/React/

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published