gsap-utils

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

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/trobias/portfolio-nextjs-v2 --skill gsap-utils-trobias
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/trobias/portfolio-nextjs-v2/tree/main/.agents/skills/gsap-utils
Command: npx skills add https://github.com/trobias/portfolio-nextjs-v2 --skill gsap-utils-trobias

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap.

What problem does it solve? Writing animation logic often requires repetitive math for mapping scroll positions to values, clamping inputs, snapping to grids, or generating random values. This Skill provides correct usage patterns for the gsap.utils helper functions so these transforms are implemented accurately in GSAP animations. ## Core Features & Use Cases - Range and Math Helpers: Covers clamp, mapRange, normalize, interpolate, wrap, and wrapYoyo for converting and constraining numeric values in tweens and callbacks. - Randomization and Snapping: Explains random (including the reusable function form via the true argument), snap, shuffle, and distribute for staggered and grid-based animations. - Parsing and Collections: Documents getUnit, unitize, splitColor, selector, toArray, and pipe for unit handling, color decomposition, scoped selectors, and function composition. - Use Case: When building a scroll-driven animation, use mapRange to convert scroll progress into rotation degrees, snap to align movement to a grid, and selector to scope element queries inside a React component. ## Quick Start Ask the assistant to show how to use gsap.utils.mapRange and clamp to convert scroll progress into a clamped animation value.

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 in GSAP animations?▼

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

How to get a reusable random function with gsap.utils.random?▼

Pass true as the last argument to gsap.utils.random, for example gsap.utils.random(-100, 100, 5, true), and it returns a function that produces a new random snapped value on each call. Unlike other utils, random does not use the omit-the-value pattern.

Does gsap.utils.mapRange handle units like px or percent?▼

No, mapRange and normalize operate on plain numbers only and do not parse units. 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 React component?▼

Use gsap.utils.selector with a container element or React ref to create a scoped selector function. The returned function finds matching elements only within that container, so selectors like .box do not match elsewhere in the document.

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 alignment. wrap cycles a value back into a min-max range, useful for infinite scrolling or cyclic values like angles.