gsap-utils

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

2|Updated Jul 25, 2026
One-click install
npx skills add https://github.com/ankaboot-source/boucle --skill gsap-utils-ankaboot-source
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/ankaboot-source/boucle/tree/main/.jcode/skills/gsap-utils
Command: npx skills add https://github.com/ankaboot-source/boucle --skill gsap-utils-ankaboot-source

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: Covers clamp, mapRange, normalize, interpolate, wrap, and wrapYoyo for converting scroll positions, progress values, and inputs into animation ranges. - Randomization and Snapping: Explains random (including the reusable function form with true), snap, shuffle, and distribute for grid-based staggers and stepped values. - Units, Colors, and Collections: Details getUnit, unitize, splitColor, selector, toArray, and pipe for unit handling, color component extraction, scoped selectors, and function composition. - Use Case: When building a scroll-driven animation, use mapRange to convert scroll progress to degrees, snap to align values to a grid, and distribute to stagger scale across elements from the center. ## Quick Start Ask the AI to show how to use gsap.utils.mapRange and snap to convert scroll progress into grid-aligned rotation values 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 map a scroll position to an animation value in GSAP?

Use 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(-200, 500, 10, true), to get a function that returns a new random snapped value on each call. Unlike other utils, random uses true instead of omitting the value.

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 or tween values.

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

Use gsap.utils.selector(scope) with a DOM element or React ref to get a scoped selector function. The returned function finds only descendant elements, so selectors like .box match inside the component rather than the whole document.

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

wrap cycles a value back into the min-max range when it exceeds the bounds, useful for infinite scroll. wrapYoyo bounces the value back at the range ends, producing back-and-forth behavior instead of a continuous cycle.