# gsap

> tweens, timelines, easing, stagger, scroll, svg, flip and split text, with a live demo of each.

source: https://learning.anthnydas.com/graphics/gsap/

## tl;dr

a tween changes values over time. a timeline lines tweens up. scroll, svg, layout and text are plugins on top.

- **duration:** 0.5 s (the default, when you leave it out)
- **ease:** power1.out (the default. quick start, soft stop)
- **plugins:** free (all of them, since 3.13)
- **from():** at once (sets its start values the moment it's made)
- **reach for it:** a sequence of ui motion, scroll-driven effects, svg strokes and shapes, layout changes, with flip

gsap is a javascript animation library. you name a target and the values it should reach, and gsap moves them there over time, one step per animation frame, in step with the browser.[^ticker] this sheet is the core (tween, timeline, ease, stagger) and five plugins. every figure waits for you: a press, a scroll or a drag. nothing moves on its own.

this page runs gsap 3.15.0. since 3.13 the whole library is free, plugins included, for commercial work too.[^free] the license is the standard "no charge" one: any site or app, paid work included. what it rules out is building gsap into a no-code animation tool that competes with webflow, which owns gsap.[^license]

## tween

a tween animates properties of a target from where they are to the values you give. `gsap.to` is the usual one. `gsap.from` runs the other way: it starts at the values you give and ends where the target already is. `gsap.fromTo` spells out both ends. `gsap.set` is a tween with no duration: the values, now. the target can be an element, a selector string, an array, or a plain object.[^to][^set]

leave `duration` out and it is 0.5 s. leave `ease` out and it is `power1.out`. `gsap.defaults` changes both for every tween made after it.[^to][^defaults]

```js
import { gsap } from 'gsap';

gsap.to('.box', { x: 200, duration: 1, ease: 'power2.out' }); // from where it is to x: 200
gsap.from('.box', { opacity: 0, y: 20 }); // starts there, ends where it already is
gsap.fromTo('.box', { x: 100 }, { x: 200, duration: 0.8 }); // both ends spelled out
gsap.set('.box', { x: 200 }); // no animation: the values, now

const tween = gsap.to('.box', { x: 200, paused: true }); // make it once, drive it later
tween.play();
tween.reverse();
tween.progress(0.5);
```

for css transforms, use the shorthands: `x` and `y` are a translate in px, `xPercent` and `yPercent` a translate in percent of the element's own size, `rotation` in degrees, `scale`. gsap applies them in one fixed order, and it skips the parsing a `transform` string would need. `autoAlpha` is opacity and visibility together, so a faded-out thing also stops taking clicks.[^css]

> **interactive figure:** one white square on a dashed track and four buttons: to, from, fromTo and set. each button runs that gsap call on the square with the default duration and ease. a dashed cyan outline marks where the square starts and an amber one where it ends, a thin bar under the track fills with the tween's progress, and a line of code shows the call that ran. a replay button runs it again.

a tween is an object you keep: `play`, `pause`, `reverse`, `restart`, `progress(0.5)`, `timeScale(2)`, `kill`.[^tween-class] a timeline has the same controls.

what trips people up:

- `from` sets its start values the moment you make it, even with a delay. in a timeline, `immediateRender: false` makes it wait for its turn.[^from]
- the flash people see comes before that. the page paints the element where it ends before your script runs, then `from` snaps it to the start. hide it in css with `visibility: hidden` and bring it in with `autoAlpha`.[^fouc]
- a `from` tween reads its end values when it first renders. run the same `from` again before it finishes and it ends short, at wherever the last one had got to. use `fromTo`, or make the tween once and `restart()` it.[^mistakes]

## timeline

`gsap.timeline()` lines tweens up. each `.to()` on it goes at the end of the timeline, unless the third argument, the position parameter, says otherwise. the timeline's `defaults` go into every tween it makes, and a tween's own vars win. the whole thing plays, pauses, reverses, scrubs and changes speed as one.[^timeline][^position]

```js
const tl = gsap.timeline({ defaults: { duration: 0.8, ease: 'power2.inOut' }, paused: true });
tl.to('.a', { x: 200 }) // at 0
  .to('.b', { x: 200 }, '<') // with the start of the previous tween
  .to('.c', { x: 200 }, '-=0.3') // 0.3 s before the end of the timeline: an overlap
  .addLabel('out')
  .to('.a', { opacity: 0 }, 'out+=0.5'); // half a second after the label

tl.play();
tl.reverse();
tl.progress(0.5); // scrub to the middle
tl.timeScale(2); // twice as fast
```

the position parameter, in one list:[^position]

- a number: seconds from the start of the timeline.
- `"+=1"` and `"-=1"`: one second after or before the end of the timeline. `"+=0"` is the default.
- `"<"` and `">"`: the start or the end of the last tween added. `"<0.2"` is 0.2 s after that start.
- a percent: `"-=25%"` is 25% of the tween being added, back from the end. `"<25%"` is 25% into the last tween.
- a label name, or `"out+=0.5"`. a label that does not exist yet is made at the end.

> **interactive figure:** three squares, a in cyan, b in amber and c in white, each on its own dashed lane. a runs for one second from the start and b for 0.6 s alongside it. a menu sets the position parameter of c, which lasts 0.8 s: left out, the start of b, the end of b, 0.3 s before or after the end, 0.2 s after b starts, half a second in, or half of c before the end. a track view under the lanes shows the three tweens as bars on a time axis with a playhead, a line says in words where c starts and ends and how long the timeline lasts, a play button runs the timeline, and a slider scrubs it.

the step-by-step movies elsewhere on this site, like the one on [merge sort](/algos/merge-sort/), are gsap timelines. `site/src/visuals/kit/use-timeline.ts` takes one from each figure, reads its chapters from labels named `c0`, `c1` and on, and seeks with `time()` when you tap or drag the progress bar.

what trips people up:

- a tween added to a timeline that has already finished does not play until the timeline runs again. to react to a click, make a new tween, or control one you made before.[^mistakes]
- `tl.to(...)` returns the timeline, which is what makes the chain work. to keep a child, make the tween first and `tl.add(tween, position)` it.[^timeline-src]
- `defaults` reach only the tweens the timeline makes, when it makes them. a tween made with `gsap.to` and then added keeps its own.[^timeline]

## easing

an ease maps time to value: progress through the duration goes in, 0 to 1, and how far along the value is comes out. the families are `power1` to `power4` (quad, cubic, quart, quint), `sine`, `expo`, `circ`, `back`, `elastic` and `bounce`, each with `.in`, `.out` and `.inOut`, plus `steps(n)` and `none`, which is linear. a bare name like `power2` means `.out`.[^eases][^ease-src]

the power outs are 1 − (1 − p)n+1: at half time, `power1.out` is 75% of the way, `power2.out` 87.5%, `power4.out` 97%. `back` runs past the end and settles; with the default overshoot of 1.70158 the peak is about 10% over. `elastic` takes an amplitude and a period, 1 and 0.3 by default. `bounce` reaches the end, then bounces three times, each bounce a quarter the height of the one before. `steps(5)` jumps five times.[^ease-src]

```js
gsap.to('.box', { x: 200, ease: 'power2.out' }); // fast start, long settle
gsap.to('.box', { x: 200, ease: 'back.out(1.7)' }); // past the end, then back
gsap.to('.box', { x: 200, ease: 'elastic.out(1, 0.3)' }); // amplitude, period
gsap.to('.box', { x: 200, ease: 'steps(5)' }); // five jumps
gsap.to('.box', { x: 200, ease: 'none' }); // linear

gsap.defaults({ ease: 'power2.out', duration: 0.6 }); // for everything after this line
gsap.timeline({ defaults: { ease: 'power2.inOut' } }); // or for one timeline's children
```

> **interactive figure:** a menu of fifteen eases, from none and the power family to back, elastic, bounce and steps. the chosen ease is drawn as a curve, time across and value up, over a dashed straight line for no ease, with a cyan line at 0 and an amber line at 1. on play a white dot crosses the plot at a steady pace while its height follows the ease, and a white square in a lane to the right rises with it. a line under the plot gives the value at half time, and how far past 1 or below 0 the ease goes.

what trips people up:

- with a scrub, the scrollbar sets the progress and the ease still bends it: `power1.out` moves most at the start of the scroll. `ease: "none"` keeps the value in step with the scroll.
- `slow`, `rough` and `expoScale` are not in the core. they come with the EasePack plugin.[^eases]

## stagger

when a tween has several targets, `stagger` spreads out their start times.[^stagger]

- a number: the gap in seconds between one start and the next.
- `each` or `amount`: the gap, or a total to split among them all.
- `from`: where the wave starts. an index, `"start"`, `"center"`, `"edges"`, `"end"` or `"random"`.
- `grid`: rows and columns, so distance is measured across the grid. `axis` keeps it to `"x"` or `"y"`.
- `ease`: how the starts are spread out. `"power2"` starts with big gaps and bunches up toward the end.
- a function of the index: each target's delay, outright.

with `each: 0.1`, five items in a row start at 0, 0.1, 0.2, 0.3 and 0.4 s. with `amount: 1`, the same five start at 0, 0.25, 0.5, 0.75 and 1 s. in a grid, the farthest cell starts at `each` times the grid's longer side, wherever the wave starts: 0.5 s in a 5 by 5 grid with `each: 0.1`.[^stagger-src]

```js
gsap.from('.cell', { scale: 0, stagger: 0.1 }); // 0.1 s between starts
gsap.from('.cell', { scale: 0, stagger: { amount: 1, from: 'end' } }); // 1 s split among all, last first
gsap.from('.cell', { scale: 0, stagger: { each: 0.1, from: 'center', grid: [5, 5] } });
gsap.from('.cell', { scale: 0, stagger: (i) => i * i * 0.02 }); // any function of the index
```

> **interactive figure:** a grid of 25 cells, each printing its delay in seconds for the chosen starting point: start, center, edges, end, index 6, or random. the first cell to move is outlined cyan and the last amber, at half a second. play shrinks and fades every cell, then grows them back in that order.

what trips people up:

- `grid: "auto"` measures the elements to find the columns, so they have to be laid out first.[^stagger]
- `from: "random"` is a new order for every tween. for one that repeats, pass a function with your own shuffle.[^stagger-src]
- `each` and `amount` answer different questions: a gap, or a total. with `amount`, more targets means smaller gaps.[^stagger]

## scrolltrigger

ScrollTrigger ties a tween or a timeline to a scroll position. `trigger` is the element it watches.[^st]

- `start` and `end` are two words: a place on the trigger, then a place on the scroller. `"top 80%"` is the trigger's top meeting the line 80% down the viewport. the defaults are `"top bottom"` and `"bottom top"`, so the trigger is in play while any of it shows.[^st-src]
- `scrub: true` ties the animation's progress to the scrollbar. a number, like `scrub: 1`, is the seconds the playhead takes to catch up.
- without a scrub, `toggleActions` says what to do at the four crossings: enter, leave, enter back, leave back. the default is `"play none none none"`.
- `pin: true` holds the trigger still while it's active, and the rest scrolls past. then the start default is `"top top"`.
- `once: true` kills the trigger the first time the end is reached. the animation stays, so it never resets or plays again.
- `scroller` measures against a scrolling box instead of the viewport. `markers: true` draws the start and the end while you work.

```js
import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);

gsap.to('.card', {
  x: '100%',
  ease: 'none',
  scrollTrigger: {
    trigger: '.card',
    scroller: '.box', // leave it out for the page itself
    start: 'top 80%', // the card's top hits 80% down the box
    end: 'bottom 20%', // the card's bottom hits 20% down the box
    scrub: true, // or 1: a second to catch up
    markers: true, // while you work
  },
});

// toggled instead of scrubbed: play on the way in, reverse on the way back up
gsap.from('.card', {
  opacity: 0,
  y: 40,
  scrollTrigger: { trigger: '.card', start: 'top 80%', toggleActions: 'play none none reverse' },
});
```

> **interactive figure:** a box 240 pixels tall with its own scrollbar. inside it, a white card labelled trigger, and two dashed lines across the box: cyan at 80% down, where the card's top starts the trigger, and amber at 20% down, where the card's bottom ends it. scrolling the box slides the card to the right while it is between the lines, a bar along the top fills with the trigger's progress, and a readout prints the progress and the scroll positions of the start and the end. a menu switches between scrub true, scrub 1, and toggleActions.

what trips people up:

- start and end are worked out when the trigger is made and when the scroller resizes, not as you scroll. if the layout changes in between, like content added above the trigger, call `ScrollTrigger.refresh()`.[^st]
- with a scrub, a tween's `duration` is a share of the scroll distance, not seconds.[^st]
- a trigger outlives the component that made it. kill it on unmount: `gsap.context()` and `useGSAP` do that for you.[^react]

## svg draw

DrawSVGPlugin reveals a stroke by animating `stroke-dasharray` and `stroke-dashoffset`. the `drawSVG` value is the part of the stroke that shows, start and end, in percent or px: `"0% 100%"` is all of it, `"20% 80%"` the middle three fifths. one value means from 0, so `"100%"` is the whole thing, and so is `true`. it works on `path`, `line`, `polyline`, `polygon`, `rect`, `ellipse` and `circle`, and it only touches the stroke.[^drawsvg][^drawsvg-src]

```js
import { DrawSVGPlugin } from 'gsap/DrawSVGPlugin';
gsap.registerPlugin(DrawSVGPlugin);

gsap.from('#path', { drawSVG: 0, duration: 1.5 }); // from nothing to the whole stroke
gsap.fromTo('#path', { drawSVG: '50% 50%' }, { drawSVG: '0% 100%' }); // from the middle outward
gsap.fromTo('#path', { drawSVG: '0 12%' }, { drawSVG: '88% 100%' }); // a dash that travels
```

> **interactive figure:** one looping stroke drawn in grey across the panel. a menu picks how the white stroke over it is drawn: from the start, from the middle outward, from the end back, or as a short dash that travels its length. play runs the tween, the line of code shows the drawSVG values used, and a note gives the path's length and which part of it the end state shows.

what trips people up:

- some browsers won't measure an element that isn't rendered, like one with `display: none` or a mask inside `defs`. make the tween once the element shows.[^drawsvg-src]
- browsers draw a stroke badly when one path has several `M` commands. split it into one path per segment.[^drawsvg]
- it needs a stroke. a shape with a fill and no stroke draws nothing.[^drawsvg]

## svg morph

MorphSVGPlugin tweens one path's `d` into another's. it converts both to cubic béziers and adds points until they have the same number, then interpolates. it morphs `path` (and the `points` of a `polyline` or `polygon`); a `circle`, `rect`, `ellipse` or `line` becomes a path first with `convertToPath`.[^morph][^morph-src]

`shapeIndex` picks which point of the start maps to the first point of the end. that matters for closed shapes: the wrong one crosses over itself halfway. `type: "rotational"` tweens the angles and lengths of the points instead of their x and y, which can look more natural.[^morph]

```js
import { MorphSVGPlugin } from 'gsap/MorphSVGPlugin';
gsap.registerPlugin(MorphSVGPlugin);

MorphSVGPlugin.convertToPath('circle, rect, ellipse, line, polygon, polyline'); // paths first

gsap.to('#shape', { morphSVG: '#star', duration: 0.8 }); // a selector, an element, or a d string
gsap.to('#shape', { morphSVG: { shape: '#star', shapeIndex: 3 } }); // which point maps to the first
gsap.to('#shape', { morphSVG: { shape: '#star', type: 'rotational' } });
```

> **interactive figure:** one white shape and five buttons: circle, star, heart, bolt and square. a button morphs the shape into that one over nine tenths of a second, and a line under it says what moved and how. a menu switches the type between linear and rotational.

what trips people up:

- a `circle` or `rect` can't morph as is. convert it, and morph the path you get back.[^morph]
- `shapeIndex` only applies to closed paths. a negative value reverses the start path.[^morph]
- the plugin keeps the original `d` in a `data-original` attribute, so morphing back to the element itself returns to it.[^morph-src]

## flip

flip is a technique: first, last, invert, play. record where things are, change the layout any way you like, move them back to where they were with transforms, then animate the transforms away.[^paul]

the Flip plugin does the recording and the animating: `Flip.getState(targets)` before the change, `Flip.from(state, vars)` after it. it returns a timeline.[^flip]

- elements match up by identity, or by `data-flip-id` when one element stands in for another.
- `absolute: true` takes the elements out of flow during the flip, which flex and grid layouts often need.
- `scale: true` resizes with transforms instead of width and height.
- `nested: true` keeps a parent's move from adding to its children's.
- `onEnter` and `onLeave` get the elements that are in only one of the two states, to fade them in or out.

```js
import { Flip } from 'gsap/Flip';
gsap.registerPlugin(Flip);

const grid = document.querySelector('.grid');
const state = Flip.getState('.tile'); // first: where everything is now
grid.classList.toggle('as-row'); // last: change the layout
// invert and play: back to where they were, then animate to where they are
Flip.from(state, {
  duration: 0.5,
  ease: 'power2.inOut',
  absolute: true,
  onEnter: (els) => gsap.fromTo(els, { opacity: 0 }, { opacity: 1 }),
  onLeave: (els) => gsap.to(els, { opacity: 0 }),
});
```

> **interactive figure:** five tiles labelled a to e in a row, and three buttons: shuffle, reverse, and a switch between a row and a three-column grid. every change re-renders the tiles in their new places, flip slides each one from where it was, and a line spells out the new order.

what trips people up:

- react renders after your click, and may make new elements. call `Flip.from` once it has, in a `useLayoutEffect`, and pass `targets` so it finds them in the state by `data-flip-id`.[^flip] the figure's hook, `kit/use-flip.ts`, does this.
- an element you remove has no end state. to fade one out, keep it in the page with `display: none` and fade it in `onLeave`. it only shows during the fade with `absolute: true` or `absoluteOnLeave: true`.[^flip]

## split text

SplitText splits an element's text into lines, words and characters, each in its own element (a `div` by default), so you can stagger them. `revert()` puts the original html back.[^split][^split-src]

- `type`: what to split. the default is `"chars,words,lines"`; split only what you need.
- `aria`: by default the element gets an `aria-label` and each piece `aria-hidden`, so a screen reader still reads the sentence.
- `mask`: wraps each piece in a clipping element, for reveals.
- `autoSplit: true`: lines depend on the width and the font, so it splits again when the fonts load or the width changes, and runs `onSplit` each time.

```js
import { SplitText } from 'gsap/SplitText';
gsap.registerPlugin(SplitText);

const split = SplitText.create('.headline', { type: 'words, chars' });
gsap.from(split.chars, { y: 16, opacity: 0, stagger: 0.02 });
// later: split.revert() puts the original html back

SplitText.create('.headline', {
  type: 'lines',
  mask: 'lines', // a clipping wrapper per line
  autoSplit: true, // split again when the width or the fonts change
  // return the tween, so a re-split reverts it and picks it up where it was
  onSplit: (self) => gsap.from(self.lines, { yPercent: 100, stagger: 0.1 }),
});
```

> **interactive figure:** the sentence 'every word moves on its own cue.' and three buttons: chars, words, lines. a button splits the sentence that way, staggers the pieces in, and prints how many there were: 26 characters, 7 words, and however many lines fit the width.

what trips people up:

- splitting by characters alone lets a word break across lines. split by words too, or set `smartWrap`.[^split]
- lines are a layout result. split after the fonts load, or let `autoSplit` do it, and make the animation inside `onSplit`.[^split]
- with `aria: "auto"`, links inside the text lose their meaning to a screen reader. the docs suggest `aria: "hidden"` and a visually hidden copy of the text.[^split]

## pitfalls

- **clean up.** a tween, a trigger or a split outlives the component that made it. `gsap.context()` collects everything made inside its function, and `revert()` undoes it all. in react, `useGSAP` from `@gsap/react` does that on unmount, which matters because strict mode runs effects twice.[^react][^context]
- **reduced motion.** `gsap.matchMedia()` runs setup code only while a media query matches, and reverts it when the query stops matching. give it one branch for `prefers-reduced-motion: reduce` and one for `no-preference`.[^matchmedia][^a11y] the figures here check the same query and jump each tween to its end with `progress(1)`.
- **register plugins.** call `gsap.registerPlugin(...)` once, before you use them. without it a bundler's tree shaking can drop the plugin.[^register]
- **transforms.** set every transform with gsap, the starting ones too, not in css. gsap reads a css transform back as a matrix in px, which loses units like `%` and can't tell 0 degrees from 360.[^mistakes][^css]
- **css transitions.** a `transition` on a property gsap animates fights every value gsap writes, and slows the tween down. take it off.[^mistakes]

[^ticker]: [gsap.ticker](https://gsap.com/docs/v3/GSAP/gsap.ticker/) in the gsap docs: it updates the global timeline on every requestAnimationFrame.

[^free]: the [3.13 release post](https://gsap.com/blog/3-13/) on gsap.com: thanks to webflow, the whole library, bonus plugins included, is free, commercial use included, and the plugins ship in the public npm package. the [pricing page](https://gsap.com/pricing/) says the entire library is free for all users, thanks to webflow.

[^license]: the [standard "no charge" license](https://gsap.com/community/standard-license/), effective april 30, 2025, read on 2026-10-28. the [readme](https://github.com/greensock/GSAP/blob/3.15.0/README.md) and `package.json` at 3.15.0 point to it. it allows gsap on any website, web app or digital interface, rules out tools that build animations without code in competition with webflow's, and leaves the intellectual property with webflow. its faq says commercial use is covered, plugins included.

[^to]: [gsap.to()](https://gsap.com/docs/v3/GSAP/gsap.to\(\)/) in the gsap docs: what a target can be, `duration` defaulting to 0.5, `ease` to `"power1.out"`, and `immediateRender` to false for `to()` and true for `from()` and `fromTo()`. the defaults in the source are [gsap-core.js](https://github.com/greensock/GSAP/blob/3.15.0/src/gsap-core.js), lines 17 to 21 and 1092.

[^set]: [gsap.set()](https://gsap.com/docs/v3/GSAP/gsap.set\(\)/) in the gsap docs: a zero-duration `to()` tween.

[^defaults]: [gsap.defaults()](https://gsap.com/docs/v3/GSAP/gsap.defaults\(\)/) in the gsap docs.

[^css]: the [css plugin](https://gsap.com/docs/v3/GSAP/CorePlugins/CSS/) page in the gsap docs: the transform shorthands, the fixed order they apply in, why a `transform` string costs more, `xPercent`, and `autoAlpha`.

[^tween-class]: [Tween](https://gsap.com/docs/v3/GSAP/Tween/) in the gsap docs: the methods.

[^from]: [gsap.from()](https://gsap.com/docs/v3/GSAP/gsap.from\(\)/) in the gsap docs: `immediateRender` is true for `from()` tweens, so the start state renders at once, whatever the delay, and `immediateRender: false` makes it wait, which is usually what you want in a timeline.

[^fouc]: [avoiding fouc](https://gsap.com/resources/fouc/) in the gsap docs: the browser paints before your javascript runs, so hide the elements with `visibility: hidden` in css and show them with `autoAlpha`.

[^mistakes]: [common gsap mistakes](https://gsap.com/resources/mistakes/) in the gsap docs: the `from()` logic issues, setting all transforms with gsap, adding tweens to a timeline that has finished, and css transitions on the same properties.

[^timeline]: [Timeline](https://gsap.com/docs/v3/GSAP/Timeline/) in the gsap docs: `defaults`, which a timeline's tweens inherit when they are created, nesting with `add()`, `timeScale()`, `progress()`, and the controls.

[^position]: [the position parameter](https://gsap.com/resources/position-parameter/) in the gsap docs, and how it is read in [gsap-core.js](https://github.com/greensock/GSAP/blob/3.15.0/src/gsap-core.js), lines 390 to 412.

[^timeline-src]: a timeline's `to()`, `from()`, `fromTo()` and `set()` end with `return this` in [gsap-core.js](https://github.com/greensock/GSAP/blob/3.15.0/src/gsap-core.js), lines 1486 to 1507.

[^eases]: [easing](https://gsap.com/docs/v3/Eases/) in the gsap docs: the families, the default of `power1.out`, and which eases live in EasePack.

[^ease-src]: the ease formulas in [gsap-core.js](https://github.com/greensock/GSAP/blob/3.15.0/src/gsap-core.js), lines 1023 to 1092: how `.out` and `.inOut` derive from `.in`, the power family, back's 1.70158, elastic's 1 and 0.3 (0.45 for inOut), bounce's four pieces, and steps. the halfway values, the 10% peak and the bounce heights are checked in `site/src/visuals/gsap/ease.test.ts` against `gsap.parseEase`.

[^stagger]: [staggers](https://gsap.com/resources/getting-started/Staggers/) in the gsap docs: the number, object and function forms, and `each`, `amount`, `from`, `grid`, `axis` and `ease`.

[^stagger-src]: `distribute()` in [gsap-core.js](https://github.com/greensock/GSAP/blob/3.15.0/src/gsap-core.js), lines 452 to 506, which turns a stagger into each target's delay, and the shuffle that `"random"` uses, line 450. the delays on this page are checked against it in `site/src/visuals/gsap/stagger.test.ts`.

[^st]: [ScrollTrigger](https://gsap.com/docs/v3/Plugins/ScrollTrigger/) in the gsap docs: `start` and `end` with their defaults, `scrub`, `toggleActions` (default `"play none none none"`), `pin`, `once`, `scroller`, `markers`, when positions are worked out and `refresh()`, and how duration works with a scrub.

[^st-src]: [ScrollTrigger.js](https://github.com/greensock/GSAP/blob/3.15.0/src/ScrollTrigger.js): the start default, `"0 100%"` or `"0 0"` when pinned, at line 853, the end default at line 890, `toggleActions: "play"` at line 143, and the catch-up tween a numeric scrub makes at lines 654 to 661.

[^drawsvg]: [DrawSVGPlugin](https://gsap.com/docs/v3/Plugins/DrawSVGPlugin/) in the gsap docs: the value syntax, the elements it works on, that it needs a stroke, `live`, and splitting a path with several segments.

[^drawsvg-src]: [DrawSVGPlugin.js](https://github.com/greensock/GSAP/blob/3.15.0/src/DrawSVGPlugin.js): how a value is read at lines 30 to 43 and 151 to 157, the lengths per element type at lines 44 to 104 with the warning about invisible elements at line 63, and what it writes to the stroke at lines 205 to 210.

[^morph]: [MorphSVGPlugin](https://gsap.com/docs/v3/Plugins/MorphSVGPlugin/) in the gsap docs: converting to cubic béziers and adding points, `convertToPath`, `shapeIndex`, and `type: "rotational"`.

[^morph-src]: [MorphSVGPlugin.js](https://github.com/greensock/GSAP/blob/3.15.0/src/MorphSVGPlugin.js): only `path`, `polyline` and `polygon` targets at lines 650 to 657, `shapeIndex` defaulting to auto at line 664, `data-original` at line 675, and the type falling back to `defaultType`, which is `"linear"`, at lines 695 and 853.

[^paul]: paul lewis, [flip your animations](https://aerotwist.com/blog/flip-your-animations/) (2015), where the technique and its name come from.

[^flip]: [Flip](https://gsap.com/docs/v3/Plugins/Flip/) and [Flip.from()](https://gsap.com/docs/v3/Plugins/Flip/static.from\(\)/) in the gsap docs: `getState`, `from`, `absolute`, `scale`, `nested`, `onEnter`, `onLeave`, `absoluteOnLeave`, `data-flip-id`, that it returns a timeline, and, for react, waiting for the render and passing `targets`.

[^split]: [SplitText](https://gsap.com/docs/v3/Plugins/SplitText/) in the gsap docs: `create`, the default `type`, `aria`, `mask`, `autoSplit` with `onSplit`, `revert`, `smartWrap`, and the note that spaces are not characters.

[^split-src]: [SplitText.ts](https://github.com/greensock/GSAP/blob/3.15.0/src/SplitText.ts): the `div` and `aria: "auto"` defaults at line 141, `aria-hidden` on each piece at line 149, the `type` default at line 355, `aria-label` at line 373, masks at lines 450 to 457, and `revert()` at lines 483 to 497.

[^react]: [gsap with react](https://gsap.com/resources/React/) in the gsap docs: `useGSAP` reverts everything made inside it on unmount, and why cleanup matters with strict mode.

[^context]: [gsap.context()](https://gsap.com/docs/v3/GSAP/gsap.context\(\)/) in the gsap docs.

[^matchmedia]: [gsap.matchMedia()](https://gsap.com/docs/v3/GSAP/gsap.matchMedia\(\)/) in the gsap docs, with the `prefers-reduced-motion` example.

[^a11y]: [accessible animation](https://gsap.com/resources/a11y/) in the gsap docs: the two matchMedia branches for reduced motion.

[^register]: [gsap.registerPlugin()](https://gsap.com/docs/v3/GSAP/gsap.registerPlugin\(\)/) and the [installation](https://gsap.com/docs/v3/Installation/) page in the gsap docs: register once, so tree shaking keeps the plugin.

## related

- https://learning.anthnydas.com/graphics/motion.md
- https://learning.anthnydas.com/graphics/three-js.md
