gsap-utils

Applies GSAP utility functions for clamping, mapping, snapping, and randomizing animation values.

Updated May 4, 2026
One-click install
npx skills add https://github.com/Gito125/gideon_portfolio --skill gsap-utils-gito125
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/Gito125/gideon_portfolio/tree/main/.github/skills/gsap-utils
Command: npx skills add https://github.com/Gito125/gideon_portfolio --skill gsap-utils-gito125

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap.

What problem does it solve? Writing animation logic often requires repetitive math for value mapping, clamping, snapping, and randomization. This Skill provides correct usage patterns for the gsap.utils helper methods so animation values are transformed accurately without hand-rolled math errors. ## Core Features & Use Cases - Range and Value Math: Use clamp, mapRange, normalize, and interpolate to convert scroll progress, pointer input, or arbitrary ranges into animation values. - Randomization and Snapping: Generate random values with random, snap values to grids or arrays with snap, shuffle arrays, and distribute values across targets with distribute. - Units, Colors, and Collections: Parse units with getUnit and unitize, split colors with splitColor, scope selectors with selector, and convert targets with toArray. - Use Case: When building a scroll-driven animation, map scroll progress (0-1) to a rotation range with mapRange, snap positions to a 20px grid, and randomize element offsets per target. ## Quick Start Ask the assistant to show how to use gsap.utils.mapRange and clamp to convert scroll progress into a rotation value for a GSAP tween.

Frequently Asked Questions about gsap-utils

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map scroll progress to an animation value in GSAP?▼

Use gsap.utils.mapRange to convert one range into another, such as mapRange(0, 1, 0, 360, progress) to turn scroll progress into degrees. Omit the value argument to get a reusable function you can call repeatedly in scroll handlers.

How to get random values in GSAP tweens?▼

Use gsap.utils.random(min, max) for a random number, or the string form "random(-100, 100)" directly in tween vars so GSAP evaluates it per target. Pass true as the last argument to get a reusable random function.

Does gsap.utils.clamp return a function or a value?▼

clamp returns a value when you pass all three arguments, and returns a reusable function when you omit the value argument. The same pattern applies to mapRange, normalize, snap, wrap, and interpolate, but random uses true as the last argument instead.

Can I snap GSAP tween values to a grid?▼

Yes, use gsap.utils.snap(increment, value) to snap a number to the nearest multiple, or pass an array of allowed values. In tweens, use the snap property like { x: 200, snap: { x: 20 } } for grid-aligned movement.

How do I scope GSAP selectors to a component or ref?▼

Use gsap.utils.selector(scope) with a DOM element or React ref to get a scoped selector function. Queries like q(".box") then only match descendants of that container, preventing selectors from hitting the whole document.

What are the limitations of gsap.utils mapRange and normalize?▼

mapRange and normalize operate only on plain numbers and do not handle units like px or percent. Use getUnit to read a unit string and unitize to append units when building CSS values.