gsap-utils

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

Updated Aug 9, 2026
One-click install
npx skills add https://github.com/HoussamMrabet/ultimate-TicTacToe --skill gsap-utils-houssammrabet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/HoussamMrabet/ultimate-TicTacToe/tree/main/skills/gsap/gsap-utils
Command: npx skills add https://github.com/HoussamMrabet/ultimate-TicTacToe --skill gsap-utils-houssammrabet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap.

What problem does it solve? Writing animation logic often requires repetitive math for clamping values, mapping ranges, snapping to grids, and generating random values. This Skill provides correct usage patterns for the gsap.utils helper methods so these transforms are applied properly in tweens, scroll handlers, and callbacks. ## Core Features & Use Cases - Range and Math Helpers: Covers clamp, mapRange, normalize, interpolate, wrap, and wrapYoyo for transforming values between ranges, including the reusable function form when the value argument is omitted. - Randomization and Snapping: Explains random (including the special true argument for reusable functions and string form in tween vars), snap for grid-aligned values, shuffle, and distribute for position-based value assignment across targets. - Collections and Parsing: Details selector for scoped component queries, toArray for converting selectors and NodeLists, pipe for composing transforms, plus getUnit, unitize, and splitColor for unit and color handling. - Use Case: When building a scroll-driven animation, use mapRange to convert scroll progress to a rotation angle, snap to lock positions to a grid, and distribute to stagger scale values from the center of a grid of elements. ## 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 tween.

Frequently Asked Questions about gsap-utils

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

FAQPage Schema
How do I use gsap.utils.mapRange to convert values between ranges?

Call gsap.utils.mapRange(inMin, inMax, outMin, outMax, value) to map a value from one range to another, such as converting 0-1 progress to 0-360 degrees. Omit the value argument to get a reusable function you can call repeatedly with the same configuration.

How do I get a reusable random function in GSAP?

Pass true as the last argument to gsap.utils.random, for example gsap.utils.random(-200, 500, 10, true). Unlike other utils, random does not use the omitted-value pattern; the returned function takes no arguments and produces a new random value each call.

Does gsap.utils.clamp work with units like px or percent?

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

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

Use gsap.utils.selector(scope) with a DOM element or ref, which returns a scoped selector function. Calls like q('.box') then match only descendants of that container, and the utility handles React refs via their .current property.

What is the difference between gsap.utils.snap and gsap.utils.wrap?

snap rounds a value to the nearest multiple or nearest value in an array, useful for grid-aligned animation. wrap cycles a value back into a min-max range, useful for infinite scroll or cyclic values, while wrapYoyo bounces back at the range ends.