gsap-utils

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

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/malikkotb/shellpluscore --skill gsap-utils-malikkotb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/malikkotb/shellpluscore/tree/main/.agents/skills/gsap-utils
Command: npx skills add https://github.com/malikkotb/shellpluscore --skill gsap-utils-malikkotb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap.

What problem does it solve? Writing animation code often requires repetitive math for value mapping, clamping, snapping, and randomization. This Skill provides correct usage patterns for the gsap.utils helper methods so animations handle ranges, units, and collections 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 progress values into animation ranges. - 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 and Collections: Parse and append units with getUnit and unitize, split colors into RGB or HSL components, scope selectors to components, and convert selectors or NodeLists to arrays with toArray. - Use Case: When building a scroll-driven animation, map scroll progress from 0-1 to a rotation of 0-360 degrees using mapRange, then snap the result to 15-degree increments for a stepped dial effect. ## Quick Start Use the gsap-utils skill to map scroll progress from 0 to 1 into a 0 to 360 degree rotation and snap the output to 15 degree steps.

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 progress value to an animation range in GSAP?

Use gsap.utils.mapRange to convert a value from one range to 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 with new progress values.

How do I get a reusable random number function in GSAP?

Pass true as the last argument to gsap.utils.random, for example gsap.utils.random(-100, 100, 5, true), which returns a function producing a new random value snapped to 5 on each call. Unlike other utils, random uses true instead of omitting the value.

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

No, 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 ref?

Use gsap.utils.selector with a DOM element or ref, including React refs with .current. The returned function finds elements only within that container, so selectors like .box match descendants of the component rather than the whole 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-aligned steps. wrap cycles a value back into a range, such as wrapping 370 degrees to 10, which suits infinite scroll or cyclic animations.