Tooluck logoTooluck
SKILL.md

gsap-utils

Agent skill fromgreensock/gsap-skills

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.

How to install gsap-utils

install gsap-utils
# install the gsap-skills pack with the skills CLI
npx skills add greensock/gsap-skills

# or add only this skill to Claude Code: copy the folder

skills/gsap-utils/

# into

~/.claude/skills/gsap-utils/ (all projects)

.claude/skills/gsap-utils/ (one project)

skills/gsap-utils/SKILL.md

MITFull file
1# gsap.utils
2
3## When to Use This Skill
4
5Apply 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).
6
7**Related skills:** Use with **gsap-core**, **gsap-timeline**, and **gsap-scrolltrigger** when building animations; CustomEase and other easing utilities are in **gsap-plugins**.
8
9## Overview
10
11**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()`).
12
13**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()](https://gsap.com/docs/v3/GSAP/UtilityMethods/random()).
14
15```javascript
16// With value: returns the result
17gsap.utils.clamp(0, 100, 150); // 100
18
19// Without value: returns a function you call with the value later
20let c = gsap.utils.clamp(0, 100);
21c(150); // 100
22c(-10); // 0
23```
24
25## Clamping and Ranges
26…

Excerpt shown under the repository's MIT license.

More skills in gsap-skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates