gsap-utils

Provide GSAP helper utilities for clamping, mapping, normalizing, and interpolating animation values.

Updated Oct 2, 2024
One-click install
npx skills add https://github.com/James-Gamboa/portfolio-james --skill gsap-utils-james-gamboa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-utils
Source: https://github.com/James-Gamboa/portfolio-james/tree/main/.agents/skills/gsap-utils
Command: npx skills add https://github.com/James-Gamboa/portfolio-james --skill gsap-utils-james-gamboa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

gsap.utils provides a collection of pure helper functions that simplify common animation math and data handling tasks, such as clamping values, mapping ranges, normalizing inputs, interpolating values, generating random results, snapping to grids, converting values to arrays, and distributing values.

Core Features & Use Cases

  • Clamp, mapRange, normalize, interpolate: transform numeric inputs to fit animation ranges.
  • Random and snap: generate stable random values or grid-aligned values for tweens and staggered effects.
  • toArray, wrap, pipe, distribute: helpers for array handling, value wrapping, and composing transforms for complex animations.
  • Use in function-based tween vars, ScrollTrigger callbacks, or any JS driving GSAP animations.

Quick Start

Start by using gsap.utils helpers like clamp, mapRange, normalize, interpolate, random, and wrap to control values in your animations.

Frequently Asked Questions about gsap-utils

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

FAQPage Schema
How do I clamp and map values for GSAP scroll-driven animations?

You can use GSAP utility helpers like clamp and mapRange to transform numeric inputs into specific animation ranges, enabling precise scroll-driven mappings and interactive value handling without external dependencies.

What is the best way to normalize and interpolate numbers in web animations?

GSAP utils provides pure helper functions like normalize and interpolate to simplify animation math, converting values into normalized ranges and smoothly transitioning between numbers for dynamic property calculations.

How do I generate stable random values and snap points for staggered tweens?

GSAP utils includes random and snap helpers to generate stable random values or grid-aligned numbers, which are ideal for controlling staggered tweens and distributing elements predictably across an animation sequence.

Can I use these GSAP utility helpers inside ScrollTrigger callbacks?

Yes, these GSAP utility helpers are designed for use within function-based tween vars, ScrollTrigger callbacks, and general value transformations, allowing direct application of clamp, wrap, and pipe during scroll-driven interactions.

Do I need external dependencies to compose complex GSAP animation transforms?

No, gsap-utils operates without external dependencies, offering pure helper functions like pipe, wrap, and toArray to compose complex transforms and handle array wrapping for interactive web animations.

Why does my GSAP animation math require value wrapping and array conversion?

GSAP utils provides wrap and toArray helpers to handle array distribution and value wrapping, ensuring continuous loops and proper iterable handling when calculating dynamic properties across staggered visual effects.