$ show greensock/GSAP
GSAP (GreenSock Animation Platform) is a mature, high-performance JavaScript animation library designed for creating complex animations in web applications. It features a plugin-based architecture where the core tweening engine is extended by plugins for specific animation types such as CSS, scroll-based motions, SVG morphing, and physics effects. The library is framework-agnostic and supports animation of CSS properties, SVG attributes, canvas objects, and JavaScript objects. The source code reveals a well-structured codebase with clear separation of concerns. Core animation logic resides in gsap-core.js, while utilities (matrix operations, string handling, path parsing, velocity tracking) are isolated in the utils directory. Plugins follow a consistent registration pattern and demonstrate attention to cross-browser compatibility, performance optimization (including requestAnimationFrame usage and tree shaking protection), and modular design. The library is actively maintained with recent updates and extensive TypeScript support.
The LLM identified 5 files worth highlighting for reuse:
Provides 2D matrix operations (translation, rotation, scaling, skew) and utility functions for applying matrices to points. Self-contained and dependency-free, suitable for any 2D graphics or animation work.
Contains emoji-safe string splitting, character iteration, and other string utilities. Handles Unicode correctly and is isolated from the rest of GSAP.
Offers a comprehensive set of SVG path parsing, conversion, measurement, and transformation functions (e.g., stringToRawPath, rawPathToString, subdivideSegment). Used by MorphSVGPlugin and MotionPathPlugin but can be used independently for SVG path processing.
Tracks the velocity of a target property over time using a history of values. Implements a fixed-size history for performance and provides getVelocity() method. Decoupled from GSAP animation specifics and useful in any motion-tracking scenario.
Abstracts different types of user interactions (pointer, touch, mouse, wheel) into a unified API. Handles browser inconsistencies and provides a clean interface for detecting user input, making it reusable in any project needing cross-browser event handling.