PluginBench
Skill
Review
Audit score 70

gsap

heygen-com/hyperframes

GSAP animation reference for HyperFrames compositions with timelines, easing, and performance optimization.

What is gsap?

GSAP animation library reference for HyperFrames. Covers core tween methods (to, from, fromTo), easing, stagger, timelines with position parameters and labels, and performance best practices. Use when building animated compositions in HyperFrames.

  • Create paused timelines synchronized with HyperFrames render cycle via window.__timelines registry
  • Animate elements using gsap.to(), from(), fromTo() with camelCase properties and transform aliases
  • Control animation timing with position parameters, labels, and nested timelines
  • Apply easing functions (power1-4, back, bounce, elastic, etc.) and stagger effects to sequences
  • Optimize performance using transforms, opacity, will-change, and gsap.quickTo() for frequent updates
  • Use function-based values and relative values (+=, -=, *=) for dynamic animations

How to install gsap

npx skills add https://github.com/heygen-com/hyperframes --skill gsap
Prerequisites
  • GSAP library loaded (e.g., from CDN: https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js)
  • HyperFrames composition with data-composition-id attribute on root element
  • DOM elements must exist before timeline creation
Claude Code
Cursor
Windsurf
Cline

How to use gsap

  1. 1.Load GSAP library via script tag or import
  2. 2.Create a paused timeline with gsap.timeline({ paused: true })
  3. 3.Add tweens using .to(), .from(), or .fromTo() with position parameters for sequencing
  4. 4.Register the timeline on window.__timelines with key matching the composition's data-composition-id
  5. 5.Use labels with addLabel() for readable animation sequences
  6. 6.Control playback with .play(), .pause(), .reverse(), .time(), or .progress() as needed

Use cases

Good for
  • Sequencing entrance animations with labels and position parameters in video compositions
  • Creating responsive animations that adapt to viewport size and prefers-reduced-motion
  • Building interactive animations triggered by mouse events using gsap.quickTo()
  • Animating SVG elements with directional rotation and SVG-specific origin handling
  • Staggering animations across multiple elements with custom timing and direction
Who it's for
  • HyperFrames composition developers
  • Motion designers building animated video content
  • Frontend developers creating performance-optimized animations
  • Developers building interactive web experiences with accessibility in mind

gsap FAQ

Why must the timeline be paused and registered on window.__timelines?

HyperFrames controls playback and seeking through the timeline registry. The paused timeline allows HyperFrames to synchronize animations with the video render cycle and scrub to any point.

Can I use infinite repeat (-1) in HyperFrames compositions?

No. HyperFrames renders finite video durations, so repeat must be a finite number computed from the visible duration. Use yoyo: true to alternate direction if needed.

What's the difference between position parameters like '<', '>', and '+=0.5'?

'<' aligns with the previous tween's start, '>' places after the previous ends, and '+=0.5' offsets 0.5s after the previous tween ends. Absolute times (e.g., 1) and labels also work.

Should I animate width/height or use transforms instead?

Always prefer transforms (x, y, scale, rotation) and opacity over layout properties. Transforms stay on the compositor and are much faster. Use will-change: transform on animated elements.

How do I handle animations that respond to user input or screen size?

Use gsap.matchMedia() to conditionally apply animations based on media queries, and gsap.quickTo() for frequent updates like mousemove events.

Full instructions (SKILL.md)

Source of truth, from heygen-com/hyperframes.


name: gsap description: GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.

GSAP

HyperFrames Contract

HyperFrames controls GSAP through its gsap runtime adapter. Create a paused timeline synchronously, register it on window.__timelines with the exact data-composition-id, and let HyperFrames seek it.

<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<script>
  window.__timelines = window.__timelines || {};
  const tl = gsap.timeline({ paused: true });

  tl.from(".title", { y: 48, opacity: 0, duration: 0.6, ease: "power3.out" }, 0);
  tl.to(".accent", { scaleX: 1, duration: 0.5, ease: "power2.out" }, 0.25);

  window.__timelines["main"] = tl; // key must equal data-composition-id on the composition root
</script>
  • The registry key must match the composition root's data-composition-id.
  • Do not call tl.play() for render-critical motion.
  • Do not build timelines inside async code, timers, or event handlers.
  • Keep loops finite. HyperFrames renders finite video durations.

Core Tween Methods

  • gsap.to(targets, vars) — animate from current state to vars. Most common.
  • gsap.from(targets, vars) — animate from vars to current state (entrances).
  • gsap.fromTo(targets, fromVars, toVars) — explicit start and end.
  • gsap.set(targets, vars) — apply immediately (duration 0).

Always use camelCase property names (e.g. backgroundColor, rotationX).

Common vars

  • duration — seconds (default 0.5).
  • delay — seconds before start.
  • ease"power1.out" (default), "power3.inOut", "back.out(1.7)", "elastic.out(1, 0.3)", "none".
  • stagger — number 0.1 or object: { amount: 0.3, from: "center" }, { each: 0.1, from: "random" }.
  • overwritefalse (default), true, or "auto".
  • repeat — finite number; never -1 in HyperFrames. Compute repeats from the visible duration. yoyo — alternates direction with repeat.
  • onComplete, onStart, onUpdate — callbacks.
  • immediateRender — default true for from()/fromTo(). Set false on later tweens targeting the same property+element to avoid overwrite.

Transforms and CSS

Prefer GSAP's transform aliases over raw transform string:

GSAP propertyEquivalent
x, y, ztranslateX/Y/Z (px)
xPercent, yPercenttranslateX/Y in %
scale, scaleX, scaleYscale
rotationrotate (deg)
rotationX, rotationY3D rotate
skewX, skewYskew
transformOrigintransform-origin
  • autoAlpha — prefer over opacity. At 0: also sets visibility: hidden.
  • CSS variables"--hue": 180.
  • svgOrigin (SVG only) — global SVG coordinate space origin. Don't combine with transformOrigin.
  • Directional rotation"360_cw", "-170_short", "90_ccw".
  • clearProps"all" or comma-separated; removes inline styles on complete.
  • Relative values"+=20", "-=10", "*=2".

Function-Based Values

gsap.to(".item", {
  x: (i, target, targets) => i * 50,
  stagger: 0.1,
});

Easing

Built-in eases: power1power4, back, bounce, circ, elastic, expo, sine. Each has .in, .out, .inOut.

Defaults

gsap.defaults({ duration: 0.6, ease: "power2.out" });

Controlling Tweens

const tween = gsap.to(".box", { x: 100 });
tween.pause();
tween.play();
tween.reverse();
tween.kill();
tween.progress(0.5);
tween.time(0.2);

gsap.matchMedia() (Responsive + Accessibility)

Runs setup only when a media query matches; auto-reverts when it stops matching.

let mm = gsap.matchMedia();
mm.add(
  {
    isDesktop: "(min-width: 800px)",
    reduceMotion: "(prefers-reduced-motion: reduce)",
  },
  (context) => {
    const { isDesktop, reduceMotion } = context.conditions;
    gsap.to(".box", {
      rotation: isDesktop ? 360 : 180,
      duration: reduceMotion ? 0 : 2,
    });
  },
);

Timelines

Creating a Timeline

const tl = gsap.timeline({ defaults: { duration: 0.5, ease: "power2.out" } });
tl.to(".a", { x: 100 }).to(".b", { y: 50 }).to(".c", { opacity: 0 });

Position Parameter

Third argument controls placement:

  • Absolute: 1 — at 1s
  • Relative: "+=0.5" — after end; "-=0.2" — before end
  • Label: "intro", "intro+=0.3"
  • Alignment: "<" — same start as previous; ">" — after previous ends; "<0.2" — 0.2s after previous starts
tl.to(".a", { x: 100 }, 0);
tl.to(".b", { y: 50 }, "<"); // same start as .a
tl.to(".c", { opacity: 0 }, "<0.2"); // 0.2s after .b starts

Labels

tl.addLabel("intro", 0);
tl.to(".a", { x: 100 }, "intro");
tl.addLabel("outro", "+=0.5");
tl.play("outro");
tl.tweenFromTo("intro", "outro");

Timeline Options

  • paused: true — create paused; call .play() to start.
  • repeat, yoyo — apply to whole timeline.
  • defaults — vars merged into every child tween.

Nesting Timelines

const master = gsap.timeline();
const child = gsap.timeline();
child.to(".a", { x: 100 }).to(".b", { y: 50 });
master.add(child, 0);

Playback Control

tl.play(), tl.pause(), tl.reverse(), tl.restart(), tl.time(2), tl.progress(0.5), tl.kill().


Performance

Prefer Transform and Opacity

Animating x, y, scale, rotation, opacity stays on the compositor. Avoid width, height, top, left when transforms achieve the same effect.

will-change

will-change: transform;

Only on elements that actually animate.

gsap.quickTo() for Frequent Updates

let xTo = gsap.quickTo("#id", "x", { duration: 0.4, ease: "power3" }),
  yTo = gsap.quickTo("#id", "y", { duration: 0.4, ease: "power3" });
container.addEventListener("mousemove", (e) => {
  xTo(e.pageX);
  yTo(e.pageY);
});

Stagger > Many Tweens

Use stagger instead of separate tweens with manual delays.

Cleanup

Pause or kill off-screen animations.


References (loaded on demand)

  • references/effects.md — Drop-in effects: typewriter text, audio visualizer. Read when needing ready-made effect patterns for HyperFrames.

Best Practices

  • Use camelCase property names; prefer transform aliases and autoAlpha.
  • Prefer timelines over chaining with delay; use the position parameter.
  • Add labels with addLabel() for readable sequencing.
  • Pass defaults into timeline constructor.
  • Store tween/timeline return value when controlling playback.

Do Not

  • Animate layout properties (width/height/top/left) when transforms suffice.
  • Use both svgOrigin and transformOrigin on the same SVG element.
  • Chain animations with delay when a timeline can sequence them.
  • Create tweens before the DOM exists.
  • Skip cleanup — always kill tweens when no longer needed.
  • Use infinite repeat values in HyperFrames compositions. Use finite repeat counts computed from the visible duration.

Credits And References