gsap-utils

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/X-manist/Cohmira --skill gsap-utils-x-manist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/X-manist/Cohmira/tree/main/src/builtin-plugins/openmontage/.agents/skills/gsap-utils
Command: npx skills add https://github.com/X-manist/Cohmira --skill gsap-utils-x-manist

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap.

What problem does it solve? Writing animation code often requires repetitive math for value mapping, clamping, randomization, and unit handling. This Skill provides correct usage patterns for the gsap.utils helper methods so animation values are computed accurately without reinventing utility logic. ## Core Features & Use Cases - Range and Value Math: Use clamp, mapRange, normalize, and interpolate to convert scroll progress, pointer input, or other signals 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 stagger-like control. - Units, Colors, and Collections: Parse units with getUnit and unitize, split colors into RGB or HSL components with splitColor, and convert selectors or NodeLists into arrays with toArray and selector. - Use Case: When building a scroll-driven animation, map scroll progress from 0-1 to a rotation of 0-360 degrees using gsap.utils.mapRange, then snap the result to 15-degree increments. ## Quick Start Ask the AI to write GSAP code that maps scroll progress to an element's rotation and snaps the result to fixed increments using gsap.utils.

Frequently Asked Questions about gsap-utils

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

FAQPage Schema
How do I map a value from one range to another in GSAP?

Use gsap.utils.mapRange(inMin, inMax, outMin, outMax, value) to convert a value between ranges, such as mapping scroll progress 0-1 to rotation 0-360. Omit the value argument to get a reusable function for repeated conversions.

How do I get a random value in a GSAP tween?

Use gsap.utils.random(min, max) for a random number, or pass an array to pick a random element. In tween vars you can use the string form like x: "random(-100, 100, 5)" which GSAP evaluates per target.

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

It depends on the arguments. Passing min, max, and value returns the clamped result immediately, while omitting the value returns a reusable function you call later with each value.

How do I snap GSAP animation values to a grid?

Use gsap.utils.snap(increment, value) to round to the nearest multiple, or pass an array of allowed values. In tweens, use the snap property like snap: { x: 20 } for step-based movement.

Can gsap.utils.mapRange handle values with units like px or %?

No, mapRange and normalize operate on plain numbers only. Use gsap.utils.getUnit to read a unit string and gsap.utils.unitize to append units when building CSS values.

How do I scope GSAP selectors to a component or container?

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