Agent skill

GSAP Utils

by greensock in greensock/gsap-skills

Covers the gsap.utils helpers for clamping, range mapping, normalizing, snapping, randomizing and wrapping values in GSAP animations.

MITAuto-check passedFrontend & Design

Install GSAP Utils

skills CLI
$ npx skills add greensock/gsap-skills --skill gsap-utils -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install greensock/gsap-skills gsap-utils --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/greensock/gsap-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/gsap-utils .claude/skills/gsap-utils && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
gsap-utils
GitHub stars
16k
Used in
4 other repos
Token cost
~3k tokens
SKILL.md length
1,080 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Covers the gsap.utils helpers for clamping, range mapping, normalizing, snapping, randomizing and wrapping values in GSAP animations.

  • Mapping scroll position or progress onto an animation value
  • SKILL.md covers When to Use This Skill, Overview, Clamping and Ranges and Random and Snap, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Snapping values to a grid or increment

What it does

The skill is a guide to gsap.utils, the set of pure helpers for math, array and collection handling, unit parsing and value mapping in animations: clamp, mapRange, normalize, interpolate, random, snap, toArray, wrap and pipe. They need no registration and can be used in tween values, ScrollTrigger or Observer callbacks, or any JavaScript that drives GSAP. Typical uses are mapping scroll to a value, randomizing, snapping to a grid and normalizing inputs.

Most utils take the value to transform as the last argument. Leaving it out returns a function that applies the same configuration later, which suits a mousemove handler or tween callback. random() is the exception: pass true as the last argument to get a reusable function. The examples show clamp limiting a value to a range, mapRange converting progress from 0 to 1 into degrees, and normalize returning a 0 to 1 value. The skill points to gsap-core, gsap-timeline and gsap-scrolltrigger for related work, and to gsap-plugins for easing utilities.

When your agent uses it

  • Mapping scroll position or progress onto an animation value
  • Snapping values to a grid or increment
  • Randomizing animation values with a reusable function
  • Clamping or normalizing inputs inside a mousemove handler

Example prompts

  • “Map scroll progress from 0 to 1 onto a rotation from 0 to 360 degrees with gsap.utils.”
  • “Snap dragged positions to a grid with gsap.utils.snap.”
  • “Write a reusable random function for staggered delays.”

What it can do on your machine

Read from SKILL.md and the folder at commit aed9cfd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • gsap.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

GSAP Utils loads about 3k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 1,080 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from greensock/gsap-skills at commit aed9cfd, republished under its MIT licence (© greensock). 1,080 words, ~3,013 tokens.

Download SKILL.mdSave it as .claude/skills/gsap-utils/SKILL.md (or your agent's skills folder).
name
gsap-utils
description
Official GSAP skill for gsap.utils — clamp, mapRange, normalize, interpolate, random, snap, toArray, wrap, pipe. Use when the user asks about gsap.utils, clamp, mapRange, random, snap, toArray, wrap, or helper utilities in GSAP.
license
MIT

gsap.utils

When to Use This Skill

Apply when writing or reviewing code that uses gsap.utils for math, array/collection handling, unit parsing, or value mapping in animations (e.g. mapping scroll to a value, randomizing, snapping to a grid, or normalizing inputs).

Related skills: Use with gsap-core, gsap-timeline, and gsap-scrolltrigger when building animations; CustomEase and other easing utilities are in gsap-plugins.

Overview

gsap.utils provides pure helpers; no need to register. Use in tween vars (e.g. function-based values), in ScrollTrigger or Observer callbacks, or in any JS that drives GSAP. All are on gsap.utils (e.g. gsap.utils.clamp()).

Omitting the value: function form. Many utils accept the value to transform as the last argument. If you omit that argument, the util returns a function that accepts the value later. Use the function form when you need to clamp, map, normalize, or snap many values with the same config (e.g. in a mousemove handler or tween callback). Exception: random() — pass true as the last argument to get a reusable function (do not omit the value); see random().

javascript
// With value: returns the result
gsap.utils.clamp(0, 100, 150); // 100

// Without value: returns a function you call with the value later
let c = gsap.utils.clamp(0, 100);
c(150);  // 100
c(-10);  // 0

Clamping and Ranges

clamp(min, max, value?)

Constrains a value between min and max. Omit value to get a function: clamp(min, max)(value).

javascript
gsap.utils.clamp(0, 100, 150); // 100
gsap.utils.clamp(0, 100, -10); // 0

let clampFn = gsap.utils.clamp(0, 100);
clampFn(150); // 100
mapRange(inMin, inMax, outMin, outMax, value?)

Maps a value from one range to another. Use when converting scroll position, progress (0–1), or input range to an animation range. Omit value to get a function: mapRange(inMin, inMax, outMin, outMax)(value).

javascript
gsap.utils.mapRange(0, 100, 0, 500, 50);  // 250
gsap.utils.mapRange(0, 1, 0, 360, 0.5);   // 180 (progress to degrees)

let mapFn = gsap.utils.mapRange(0, 100, 0, 500);
mapFn(50);  // 250
normalize(min, max, value?)

Returns a value normalized to 0–1 for the given range. Inverse of mapping when the target range is 0–1. Omit value to get a function: normalize(min, max)(value).

javascript
gsap.utils.normalize(0, 100, 50);   // 0.5
gsap.utils.normalize(100, 300, 200); // 0.5

let normFn = gsap.utils.normalize(0, 100);
normFn(50); // 0.5
interpolate(start, end, progress?)

Interpolates between two values at a given progress (0–1). Handles numbers, colors, and objects with matching keys. Omit progress to get a function: interpolate(start, end)(progress).

javascript
gsap.utils.interpolate(0, 100, 0.5);       // 50
gsap.utils.interpolate("#ff0000", "#0000ff", 0.5); // mid color
gsap.utils.interpolate({ x: 0, y: 0 }, { x: 100, y: 50 }, 0.5); // { x: 50, y: 25 }

let lerp = gsap.utils.interpolate(0, 100);
lerp(0.5); // 50

Random and Snap

random(minimum, maximum[, snapIncrement, returnFunction]) / random(array[, returnFunction])

Returns a random number in the range minimum–maximum, or a random element from an array. Optional snapIncrement snaps the result to the nearest multiple (e.g. 5 → multiples of 5). To get a reusable function, pass true as the last argument (returnFunction); the returned function takes no args and returns a new random value each time. This is the only util that uses true for the function form instead of omitting the value.

javascript
// immediate value: number in range
gsap.utils.random(-100, 100);        // e.g. 42.7
gsap.utils.random(0, 500, 5);        // 0–500, snapped to nearest 5

// reusable function: pass true as last argument
let randomFn = gsap.utils.random(-200, 500, 10, true);
randomFn();  // random value in range, snapped to 10
randomFn();  // another random value

// array: pick one value at random
gsap.utils.random(["red", "blue", "green"]);  // "red", "blue", or "green"
let randomFromArray = gsap.utils.random([0, 100, 200], true);
randomFromArray();  // 0, 100, or 200

String form in tween vars: use "random(-100, 100)", "random(-100, 100, 5)", or "random([0, 100, 200])"; GSAP evaluates it per target.

javascript
gsap.to(".box", { x: "random(-100, 100, 5)", duration: 1 });
gsap.to(".item", { backgroundColor: "random([red, blue, green])" });
snap(snapTo, value?)

Snaps a value to the nearest multiple of snapTo, or to the nearest value in an array of allowed values. Omit value to get a function: snap(snapTo)(value) (or snap(snapArray)(value)).

javascript
gsap.utils.snap(10, 23);     // 20
gsap.utils.snap(0.25, 0.7);  // 0.75
gsap.utils.snap([0, 100, 200], 150); // 100 or 200 (nearest in array)

let snapFn = gsap.utils.snap(10);
snapFn(23); // 20

Use in tweens for grid or step-based animation:

javascript
gsap.to(".x", { x: 200, snap: { x: 20 } });
shuffle(array)

Returns a new array with the same elements in random order. Use for randomizing order (e.g. stagger from "random" with a copy).

javascript
gsap.utils.shuffle([1, 2, 3, 4]); // e.g. [3, 1, 4, 2]
distribute(config)

Returns a function that assigns a value to each target based on its position in the array (or in a grid). Used internally for advanced staggers; use it whenever you need values spread across many elements (e.g. scale, opacity, x, delay). The returned function receives (index, target, targets) — either call it manually or pass the result directly into a tween; GSAP will call it per target with index, element, and array.

Config (all optional):

PropertyTypeDescription
baseNumberStarting value. Default 0.
amountNumberTotal to distribute across all targets (added to base). E.g. amount: 1 with 100 targets → 0.01 between each. Use each instead to set a fixed step per target.
eachNumberAmount to add between each target (added to base). E.g. each: 1 with 4 targets → 0, 1, 2, 3. Use amount instead to split a total.
fromNumber | String | ArrayWhere distribution starts: index, or "start", "center", "edges", "random", "end", or ratios like [0.25, 0.75]. Default 0.
gridString | ArrayUse grid position instead of flat index: [rows, columns] (e.g. [5, 10]) or "auto" to detect. Omit for flat array.
axisStringFor grid: limit to one axis ("x" or "y").
easeEaseDistribute values along an ease curve (e.g. "power1.inOut"). Default "none".

In a tween: pass the result of distribute(config) as the property value; GSAP calls the function for each target with (index, target, targets).

javascript
// Scale: middle elements 0.5, outer edges 3 (amount 2.5 distributed from center)
gsap.to(".class", {
  scale: gsap.utils.distribute({
    base: 0.5,
    amount: 2.5,
    from: "center"
  })
});

Manual use: call the returned function with (index, target, targets) to get the value for that index.

javascript
const distributor = gsap.utils.distribute({
  base: 50,
  amount: 100,
  from: "center",
  ease: "power1.inOut"
});
const targets = gsap.utils.toArray(".box");
const valueForIndex2 = distributor(2, targets[2], targets);

See distribute() for more.

Show full SKILL.md (377 more words)Show less

Units and Parsing

getUnit(value)

Returns the unit string of a value (e.g. "px", "%", "deg"). Use when normalizing or converting values.

javascript
gsap.utils.getUnit("100px");   // "px"
gsap.utils.getUnit("50%");     // "%"
gsap.utils.getUnit(42);        // "" (unitless)
unitize(value, unit)

Appends a unit to a number, or returns the value as-is if it already has a unit. Use when building CSS values or tween end values.

javascript
gsap.utils.unitize(100, "px");  // "100px"
gsap.utils.unitize("2rem", "px"); // "2rem" (unchanged)
splitColor(color, returnHSL?)

Converts a color string into an array: [red, green, blue] (0–255), or [red, green, blue, alpha] (4 elements for RGBA when alpha is present or required). Pass true as the second argument (returnHSL) to get [hue, saturation, lightness] or [hue, saturation, lightness, alpha] (HSL/HSLA) instead. Works with "rgb()", "rgba()", "hsl()", "hsla()", hex, and named colors (e.g. "red"). Use when animating color components or building gradients. See splitColor().

javascript
gsap.utils.splitColor("red");                    // [255, 0, 0]
gsap.utils.splitColor("#6fb936");                // [111, 185, 54]
gsap.utils.splitColor("rgba(204, 153, 51, 0.5)"); // [204, 153, 51, 0.5] (4 elements)
gsap.utils.splitColor("#6fb936", true);          // [94, 55, 47] (HSL: hue, saturation, lightness)

Arrays and Collections

selector(scope)

Returns a scoped selector function that finds elements only within the given element (or ref). Use in components so selectors like ".box" match only descendants of that component, not the whole document. Accepts a DOM element or a ref (e.g. React ref; handles .current).

javascript
const q = gsap.utils.selector(containerRef);
q(".box");        // array of .box elements inside container
gsap.to(q(".circle"), { x: 100 });
toArray(value, scope?)

Converts a value to an array: selector string (scoped to element), NodeList, HTMLCollection, single element, or array. Use when passing mixed inputs to GSAP (e.g. targets) and a true array is needed.

javascript
gsap.utils.toArray(".item");           // array of elements
gsap.utils.toArray(".item", container); // scoped to container
gsap.utils.toArray(nodeList);          // [ ... ] from NodeList
pipe(...functions)

Composes functions: pipe(f1, f2, f3)(value) returns f3(f2(f1(value))). Use when applying a chain of transforms (e.g. normalize → mapRange → snap) in a tween or callback.

javascript
const fn = gsap.utils.pipe(
  (v) => gsap.utils.normalize(0, 100, v),
  (v) => gsap.utils.snap(0.1, v)
);
fn(50); // normalized then snapped
wrap(min, max, value?)

Wraps a value into the range min–max (inclusive min, exclusive max). Use for infinite scroll or cyclic values. Omit value to get a function: wrap(min, max)(value).

javascript
gsap.utils.wrap(0, 360, 370);  // 10
gsap.utils.wrap(0, 360, -10);   // 350

let wrapFn = gsap.utils.wrap(0, 360);
wrapFn(370); // 10
wrapYoyo(min, max, value?)

Wraps value in range with a yoyo (bounces at ends). Use for back-and-forth within a range. Omit value to get a function: wrapYoyo(min, max)(value).

javascript
gsap.utils.wrapYoyo(0, 100, 150); // 50 (bounces back)

let wrapY = gsap.utils.wrapYoyo(0, 100);
wrapY(150); // 50

Best practices

  • ✅ Omit the value argument to get a reusable function when the same range/config is used many times (e.g. scroll handler, tween callback): let mapFn = gsap.utils.mapRange(0, 1, 0, 360); mapFn(progress).
  • ✅ Use snap for grid-aligned or step-based values; use toArray when GSAP or your code needs a real array from a selector or NodeList.
  • ✅ Use gsap.utils.selector(scope) in components so selectors are scoped to a container or ref.

Do Not

  • ❌ Assume mapRange / normalize handle units; they work on numbers. Use getUnit / unitize when units matter.
  • ❌ Override or rely on undocumented behavior; stick to the documented API.
Learn More

https://gsap.com/docs/v3/HelperFunctions

© greensock, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/gsap-utils of greensock/gsap-skills.

Open the folder on GitHubat commit aed9cfd

Used in 5 other repositories

We found 5 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 4 other GitHub owners. This page covers the copy in greensock/gsap-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

GSAP Utils next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

GSAP Utils compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
GSAP Utils this skillgreensock/gsap-skills16k4 repos~3kAutomated safety check: PassMIT
Fixing Motion Performanceibelick/ui-skills9.5k5 repos~1.4kAutomated safety check: PassMIT
Motion DesignLottieFiles/motion-design-skill2k1 repos~3.1kAutomated safety check: PassMIT
Gsapboraoztunc/skills3975 repos~1.9kAutomated safety check: PassApache-2.0
Auteuragiwhitelist/auteur1k—~5kAutomated safety check: PassMIT
Animate Textpixel-point/animate-text1491 repos~1.6kAutomated safety check: PassNone

Similar skills

  • Fixing Motion Performance

    ibelick/ui-skills

    Audits and fixes web animation performance: layout thrashing, work that belongs on the compositor, scroll-linked motion and costly blur effects.

    9.5k GitHub starsUsed in 5 repos~1.4k tokens
    Frontend & DesignAuto-check passed
  • Motion Design

    LottieFiles/motion-design-skill

    Applies motion design principles to create emotionally-driven, technically sound animations and transitions.

    2k GitHub starsUsed in 1 repo~3.1k tokens
    Frontend & DesignAuto-check passed
  • Gsap

    boraoztunc/skills

    GSAP animation reference for HyperFrames. An agent skill from boraoztunc/skills.

    397 GitHub starsUsed in 5 repos~1.9k tokens
    Frontend & DesignAuto-check passed
  • Auteur

    agiwhitelist/auteur

    Design and build complete web experiences from scratch — award-level product and marketing pages, cinematic scroll-directed sites where the page is directed like a film, and multi-screen products…

    1k GitHub stars~5k tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed
  • Animate Text

    pixel-point/animate-text

    Curated text animation catalog with exact JSON specs for headings, labels, counters, and text swaps.

    149 GitHub starsUsed in 1 repo~1.6k tokens
    Frontend & DesignAuto-check passed
  • Silk Design

    bendrape1-byte/silk-design

    Build websites and web UI with smooth, polished, high-end motion by default — the buttery feel of premium sites, not static slop.

    138 GitHub stars~1.8k tokensUpdated 1 mo ago
    Frontend & DesignAuto-check passed

More from greensock/gsap-skills

All 8 skills in this repo
  • GSAP ScrollTrigger

    greensock/gsap-skills

    Teaches an agent how to wire up GSAP's ScrollTrigger plugin for scroll-linked animation, pinned sections and scrub, including the start and end position syntax.

    16k GitHub starsUsed in 5 repos~4.6k tokens
    Auto-check passed
  • GSAP Core Animation

    greensock/gsap-skills

    Covers the GSAP core API for tweens, easing, staggers, defaults and matchMedia, and when to choose GSAP over CSS animations or other JavaScript animation libraries.

    16k GitHub starsUsed in 4 repos~3.7k tokens
    Auto-check passed
  • GSAP in Vue, Nuxt and Svelte

    greensock/gsap-skills

    Shows how to use GSAP in Vue, Nuxt, Svelte and other lifecycle-based frameworks: create after mount, scope selectors to the component, and revert on unmount.

    16k GitHub starsUsed in 4 repos~2.6k tokens
    Auto-check passed
  • GSAP Performance Tuning

    greensock/gsap-skills

    Guides the agent to keep GSAP animations smooth by animating transforms and opacity, batching DOM reads and writes, and avoiding layout-heavy properties.

    16k GitHub starsUsed in 4 repos~1k tokens
    Auto-check passed
  • GSAP for React

    greensock/gsap-skills

    Shows how to run GSAP animations in React and Next.js with the useGSAP hook, refs, scoped selectors and automatic cleanup on unmount.

    16k GitHub starsUsed in 4 repos~1.6k tokens
    Auto-check passed
  • GSAP Timeline

    greensock/gsap-skills

    Teaches the GSAP timeline API for sequencing animations: gsap.timeline(), the position parameter, labels, defaults, nesting and playback control.

    16k GitHub starsUsed in 4 repos~1.1k tokens
    Auto-check passed

Works with

Questions about GSAP Utils

What does GSAP Utils do?

Covers the gsap.utils helpers for clamping, range mapping, normalizing, snapping, randomizing and wrapping values in GSAP animations. utils, the set of pure helpers for math, array and collection handling, unit parsing and value mapping in animations: clamp, mapRange, normalize, interpolate, random, snap, toArray, wrap and pipe. They need no registration and can be used in tween values, ScrollTrigger or Observer callbacks, or any JavaScript that drives GSAP.

When should I use GSAP Utils?

GSAP Utils fits situations like: mapping scroll position or progress onto an animation value; snapping values to a grid or increment; randomizing animation values with a reusable function; clamping or normalizing inputs inside a mousemove handler.

How do I install GSAP Utils in Claude Code?

Run `npx skills add greensock/gsap-skills --skill gsap-utils -a claude-code`. Or copy the skill folder (skills/gsap-utils in greensock/gsap-skills) into .claude/skills/gsap-utils in your project. Claude Code loads it when a task matches its description.

How do I install GSAP Utils in Codex?

Run `npx skills add greensock/gsap-skills --skill gsap-utils -a codex`. Or copy the skill folder (skills/gsap-utils in greensock/gsap-skills) into .agents/skills/gsap-utils in your project. Codex loads it when a task matches its description.

Can I use GSAP Utils in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add greensock/gsap-skills --skill gsap-utils -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gsap-utils, .gemini/skills/gsap-utils, .github/skills/gsap-utils and .opencode/skills/gsap-utils in your project.

What does GSAP Utils need to run?

SKILL.md names no scripts, command-line tools or credentials: GSAP Utils is instructions for the agent only.

Does GSAP Utils access the network?

SKILL.md names 1 domain. As links in the text: gsap.com. This is read from the text; nothing was executed.

Is GSAP Utils safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does GSAP Utils use?

GSAP Utils is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does GSAP Utils use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to GSAP Utils?

Skills that share tags, products or a category with GSAP Utils: Fixing Motion Performance (ibelick/ui-skills, 9.5k stars), Motion Design (LottieFiles/motion-design-skill, 2k stars), Gsap (boraoztunc/skills, 397 stars) and Auteur (agiwhitelist/auteur, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains GSAP Utils?

greensock (a GitHub organization) maintains it in greensock/gsap-skills, which has 16,062 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on July 29, 2026.

Source: greensock/gsap-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.