Agent skill Web motion
GSAP Utils
Design, implement or review motion on the web.
Install the skill
Run the command from your project root with Node.js and npm.
npx skills@latest add greensock/gsap-skills --skill gsap-utils --agent claude-code --yesCheck this file in your project.claude/skills/gsap-utils/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add greensock/gsap-skills --skill gsap-utilsSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. An existing native range input or a small test fixture, with GSAP and a paused tween or timeline.
View operation manualWhat this skill helps with
- Design, implement or review motion on the web.
Good for
- Web motion and transitions
- Publisher
- GreenSock
- Installed content
- SKILL.md with workflow guidance
- Result
- A range input that drives bounded progress and retains its keyboard controls.
- Skill name
gsap-utils- Repository
greensock/gsap-skills
Common pitfall
Avoid this prompt
Feed the slider value directly to progress() and round on every input event.
Slider units can differ from progress units, and snapping on every event can make the animation jump instead of following the drag.
Use these steps
- Use the slider’s configured min and max and list the intended snap points if needed.
- Map control units to 0–1 and apply snap only on settled selection when requested.
- Test reported progress with dragging, keyboard input, and an out-of-range value passed to the mapping logic.
Hands-on walkthrough
Connect a native slider to a paused animation with continuous progress and optional snap points on commit.
Connect a native slider to a paused animation with continuous progress and optional snap points on commit.
Record the input and output ranges
Use the slider’s configured min and max and list the intended snap points if needed.
Prompt · Step 1Use gsap-utils to inspect [slider and preview]. Record the native range input’s min, max, step, current value, and accessible label. Identify the paused tween or timeline and where its progress is set. Confirm whether final selections should snap to discrete values.Map and bound the progress
Map control units to 0–1 and apply snap only on settled selection when requested.
Prompt · Step 2Convert valueAsNumber with gsap.utils.mapRange(min, max, 0, 1, value), then bound the result using gsap.utils.clamp(0, 1, progress). For example, 100 in a 0–200 range maps to 0.5. Send bounded progress to the paused tween or timeline during input. If discrete final positions are required, use gsap.utils.snap([0, 0.5, 1], progress) on commit and sync any readout that describes the settled progress. Keep the native slider’s keyboard behavior.Check boundaries and input modes
Test reported progress with dragging, keyboard input, and an out-of-range value passed to the mapping logic.
- Min, midpoint, and max yield 0, 0.5, and 1 before optional snapping.
- Out-of-range values clamp and keyboard input still updates the preview.
Prompt · Step 3Exercise min, midpoint, and max in the preview with dragging and the keyboard. Pass an out-of-range number directly to the mapping and clamping logic, since the native input may clamp its DOM value. If snap is enabled, verify continuous feedback during drag and the expected settled progress after pointer or keyboard input. Report the resulting progress values.
API lookup
Use these calls when adapting the walkthrough to your component.
Normalize slider unitsGSAP
- Command or reference
mapRange() + clamp()- Examples
- Map the control’s configured bounds to 0–1, then clamp programmatic values.
Settle on a named positionGSAP
- Command or reference
snap([0, 0.5, 1], progress)- Examples
- A normalized progress of 0.7 snaps to 0.5 with these anchors.
FAQ
Does mapRange() clamp values?
mapRange() extrapolates outside the source range. Use clamp() after mapping when the destination must stay within its bounds.
What does installing the skill add?
The project skill folder contains the publisher’s SKILL.md. Your application still needs its own GSAP dependency and a page to run the animation.