# greensock/gsap architecture

> Architecture diagram of the GitHub repository greensock/gsap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/greensock/gsap
- Repository: https://github.com/greensock/gsap

## Overview

#### Purpose and Consumption

GSAP is a zero-dependency, framework-agnostic browser JavaScript animation engine. It interpolates and applies values over time to CSS, SVG, canvas, and arbitrary JavaScript objects. Primary source entry points are `src/index.js` (core package import) and `src/all.js` (core plus public plugins); browser-compatible UMD artifacts are published under `dist/`, notably `dist/gsap.js` and `dist/all.js`.

#### Core Animation Runtime

`src/gsap-core.js` owns the animation model: tweens, timelines, easing, ticker-driven rendering, overwrite/lifecycle behavior, callbacks, and utility APIs. It is the central control boundary: user calls create animation instances, the ticker advances time, and render passes resolve and update target properties. `src/index.js` composes this core with the default CSS integration.

#### Property Rendering Layer

`src/CSSPlugin.js` translates generic tween properties into browser style/transform updates, handling CSS-specific normalization and rendering. Core-level property tweening delegates to registered plugins when they claim a property or target type. This keeps the timing/sequencing engine in `src/gsap-core.js` independent from DOM/CSS mechanics.

#### Plugin Registration and Extensions

Plugins are separately importable modules that integrate through explicit `gsap.registerPlugin(...)`; they extend target parsing, rendering, or interaction/input behavior without requiring the core to depend on them. Aggregated exports in `src/all.js` expose the standard toolset. Major extension families include:
- Scroll and viewport orchestration: `src/ScrollTrigger.js`, `src/ScrollSmoother.js`, `src/Observer.js`.
- Direct manipulation and inertia: `src/Draggable.js`, `src/InertiaPlugin.js`.
- Geometry/path transformations: `src/MotionPathPlugin.js`, `src/MorphSVGPlugin.js`, `src/Flip.js`.
- Content and special-property rendering: `src/SplitText.js`, `src/TextPlugin.js`, `src/DrawSVGPlugin.js`.

#### Geometry and Motion Utilities

Reusable path, matrix, and velocity primitives support SVG motion, transforms, draggable interaction, and related plugins. `src/utils/paths.js` handles path-oriented calculations; `src/utils/matrix.js` provides transform/matrix handling; `src/utils/VelocityTracker.js` supplies sampled velocity data used by inertia-oriented behavior. `src/MotionPathHelper.js` adds an authoring/debug interaction layer over motion-path facilities.

#### Distribution Boundaries

Authoritative implementation is in `src/`; ES-module deliverables mirror it in `esm/`, with package-facing entry modules `esm/index.js` and `esm/all.js`. `dist/` provides UMD files for script-tag, AMD/CommonJS-compatible environments and individually consumable plugin bundles, e.g. `dist/ScrollTrigger.js` and `dist/Draggable.js`. TypeScript consumers receive declaration-only API contracts under `types/`, centered on `types/index.d.ts` and `types/gsap-core.d.ts`.

#### Runtime and External Dependencies

The library targets major web browsers and uses browser facilities such as DOM/CSS, SVG, scrolling, and pointer/touch/wheel events when relevant plugins are enabled. It has no runtime dependencies and no backend or required external service. NPM package imports and CDN-hosted `dist/` artifacts are alternative delivery mechanisms; React support mentioned by documentation is supplied by a separate package, not this repository.

Main entry points: [`src/all.js`](https://github.com/greensock/gsap/blob/master/src/all.js) (All-plugins entry), [`src/index.js`](https://github.com/greensock/gsap/blob/master/src/index.js) (Core entry), [`src/gsap-core.js`](https://github.com/greensock/gsap/blob/master/src/gsap-core.js) (Animation runtime), [`src/MotionPathPlugin.js`](https://github.com/greensock/gsap/blob/master/src/MotionPathPlugin.js) (Motion and geometry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Core Runtime"]
  node_index["Core entry<br/>ES module<br/>[index.js]"]
  node_core{{"Animation runtime<br/>engine<br/>[gsap-core.js]"}}
end

subgraph group_rendering["Property Rendering"]
  node_css["CSSPlugin<br/>property plugin<br/>[CSSPlugin.js]"]
end

subgraph group_plugins["Extensions"]
  node_all["All-plugins entry<br/>ES module<br/>[all.js]"]
  node_scroll["Scroll extensions<br/>plugin family<br/>[ScrollTrigger.js]"]
  node_drag["Drag and inertia<br/>plugin family<br/>[Draggable.js]"]
  node_motion["Motion and geometry<br/>plugin family"]
  node_content["Content renderers<br/>plugin family<br/>[SplitText.js]"]
  node_helper["Motion path helper<br/>authoring plugin"]
  node_paths["Path utilities<br/>geometry utility<br/>[paths.js]"]
  node_matrix["Matrix utilities<br/>transform utility<br/>[matrix.js]"]
  node_velocity["Velocity tracker<br/>motion utility<br/>[VelocityTracker.js]"]
end

subgraph group_delivery["Package Delivery"]
  node_esm["ESM deliverables<br/>published modules<br/>[index.js]"]
  node_umd["UMD bundles<br/>published bundles<br/>[gsap.js]"]
  node_types["Type declarations<br/>TypeScript contracts<br/>[index.d.ts]"]
end

node_consumer(("Application code<br/>consumer"))
node_browser(("Browser APIs<br/>runtime platform"))

node_consumer -->|"imports core package"| node_index
node_consumer -->|"imports standard toolset"| node_all
node_consumer -.->|"loads browser bundle"| node_umd
node_index -->|"exports"| node_core
node_index -->|"registers default integration"| node_css
node_all -->|"includes core entry"| node_index
node_all -->|"exports"| node_scroll
node_all -->|"exports"| node_drag
node_all -->|"exports"| node_motion
node_all -->|"exports"| node_content
node_core -->|"delegates claimed properties"| node_css
node_core -->|"renders through"| node_browser
node_scroll -->|"uses scroll and input"| node_browser
node_drag -->|"uses"| node_velocity
node_drag -->|"uses transforms"| node_matrix
node_motion -->|"uses path calculations"| node_paths
node_motion -->|"uses transforms"| node_matrix
node_helper -->|"authors and debugs"| node_motion
node_esm -.->|"mirrors"| node_index
node_umd -.->|"bundles"| node_index
node_types -.->|"declares API for"| node_core

click node_index "https://github.com/greensock/gsap/blob/master/src/index.js"
click node_core "https://github.com/greensock/gsap/blob/master/src/gsap-core.js"
click node_css "https://github.com/greensock/gsap/blob/master/src/CSSPlugin.js"
click node_all "https://github.com/greensock/gsap/blob/master/src/all.js"
click node_scroll "https://github.com/greensock/gsap/blob/master/src/ScrollTrigger.js"
click node_drag "https://github.com/greensock/gsap/blob/master/src/Draggable.js"
click node_motion "https://github.com/greensock/gsap/blob/master/src/MotionPathPlugin.js"
click node_content "https://github.com/greensock/gsap/blob/master/src/SplitText.js"
click node_helper "https://github.com/greensock/gsap/blob/master/src/MotionPathHelper.js"
click node_paths "https://github.com/greensock/gsap/blob/master/src/utils/paths.js"
click node_matrix "https://github.com/greensock/gsap/blob/master/src/utils/matrix.js"
click node_velocity "https://github.com/greensock/gsap/blob/master/src/utils/VelocityTracker.js"
click node_esm "https://github.com/greensock/gsap/blob/master/esm/index.js"
click node_umd "https://github.com/greensock/gsap/blob/master/dist/gsap.js"
click node_types "https://github.com/greensock/gsap/blob/master/types/index.d.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index,node_core toneBlue
class node_css toneAmber
class node_all,node_scroll,node_drag,node_motion,node_content,node_helper,node_paths,node_matrix,node_velocity toneMint
class node_esm,node_umd,node_types toneRose
class node_consumer,node_browser toneNeutral
```

## Components

### Core Runtime

- [Core entry](https://github.com/greensock/gsap/blob/master/src/index.js): ES module · Composes GSAP core with the default CSS integration. · `src/index.js`
- [Animation runtime](https://github.com/greensock/gsap/blob/master/src/gsap-core.js): engine · Owns tweens, timelines, ticker, rendering lifecycle, and utilities. · `src/gsap-core.js`

### Property Rendering

- [CSSPlugin](https://github.com/greensock/gsap/blob/master/src/CSSPlugin.js): property plugin · Maps tween properties to browser style and transform updates. · `src/CSSPlugin.js`

### Extensions

- [All-plugins entry](https://github.com/greensock/gsap/blob/master/src/all.js): ES module · Aggregates the standard public plugin toolset. · `src/all.js`
- [Scroll extensions](https://github.com/greensock/gsap/blob/master/src/ScrollTrigger.js): plugin family · ScrollTrigger, ScrollSmoother, and Observer orchestration. · `src/ScrollTrigger.js`
- [Drag and inertia](https://github.com/greensock/gsap/blob/master/src/Draggable.js): plugin family · Direct manipulation backed by velocity-based inertia. · `src/Draggable.js`
- [Motion and geometry](https://github.com/greensock/gsap/blob/master/src/MotionPathPlugin.js): plugin family · Motion paths, SVG morphing, and FLIP transforms. · `src/MotionPathPlugin.js`
- [Content renderers](https://github.com/greensock/gsap/blob/master/src/SplitText.js): plugin family · SplitText, TextPlugin, and DrawSVGPlugin. · `src/SplitText.js`
- [Motion path helper](https://github.com/greensock/gsap/blob/master/src/MotionPathHelper.js): authoring plugin · Interactive authoring and debugging layer for motion paths. · `src/MotionPathHelper.js`
- [Path utilities](https://github.com/greensock/gsap/blob/master/src/utils/paths.js): geometry utility · `src/utils/paths.js`
- [Matrix utilities](https://github.com/greensock/gsap/blob/master/src/utils/matrix.js): transform utility · `src/utils/matrix.js`
- [Velocity tracker](https://github.com/greensock/gsap/blob/master/src/utils/VelocityTracker.js): motion utility · Samples velocity for inertia-oriented behavior. · `src/utils/VelocityTracker.js`

### Package Delivery

- [ESM deliverables](https://github.com/greensock/gsap/blob/master/esm/index.js): published modules · Mirrors source for package module consumers. · `esm/index.js`
- [UMD bundles](https://github.com/greensock/gsap/blob/master/dist/gsap.js): published bundles · Script-tag, AMD, and CommonJS-compatible artifacts. · `dist/gsap.js`
- [Type declarations](https://github.com/greensock/gsap/blob/master/types/index.d.ts): TypeScript contracts · Declaration-only public API contracts. · `types/index.d.ts`

### Other components

- **Application code**: consumer · Creates animations and registers optional plugins.
- **Browser APIs**: runtime platform · DOM, CSS, SVG, scrolling, and input facilities.

## Connections

- Application code → Core entry: imports core package
- Application code → All-plugins entry: imports standard toolset
- Application code → UMD bundles: loads browser bundle
- Core entry → Animation runtime: exports
- Core entry → CSSPlugin: registers default integration
- All-plugins entry → Core entry: includes core entry
- All-plugins entry → Scroll extensions: exports
- All-plugins entry → Drag and inertia: exports
- All-plugins entry → Motion and geometry: exports
- All-plugins entry → Content renderers: exports
- Animation runtime → CSSPlugin: delegates claimed properties
- Animation runtime → Browser APIs: renders through
- Scroll extensions → Browser APIs: uses scroll and input
- Drag and inertia → Velocity tracker: uses
- Drag and inertia → Matrix utilities: uses transforms
- Motion and geometry → Path utilities: uses path calculations
- Motion and geometry → Matrix utilities: uses transforms
- Motion path helper → Motion and geometry: authors and debugs
- ESM deliverables → Core entry: mirrors
- UMD bundles → Core entry: bundles
- Type declarations → Animation runtime: declares API for
