All products

Map animation values with AI and GSAP

Convert an input range into usable motion values, apply limits and choose when an interaction should snap to a step.

You can map animation values with AI and GSAP when a physical distance needs a different meaning on screen. A slider might travel 240 pixels while controlling playback speed from 0.5 to 2. The gsap-utils skill helps a coding agent express that relationship and decide what happens at either end.

Some controls need continuous movement and others should stop at a set of allowed values. The guide covers range mapping, clamping, snapping and units, along with helpers for arrays and repeated calculations. You can describe the behaviour in terms of the control you want to build.

What it does

  • Turn a drag distance into a percentage or playback rate.
  • Keep an input inside a permitted numerical range.
  • Snap a handle to the nearest marker on a timeline.
  • Restore the correct unit after a calculation.
  • Choose a random value within a specified interval for a visual effect.

Install and use

  1. Prepare an authorised web project with the official GSAP package. Identify the input source, output property and units.
  2. Ask for the 240-pixel slider to control playback between 0.5 and 2 in steps of 0.25.
  3. Check both endpoints, a few values in between and one value outside the expected range.

FAQ

Source

Made by GreenSock (Webflow). Original skill: gsap-utils, published on GitHub under the MIT licence.

View on GitHub