GSAP (GreenSock Animation Platform)
Ultra high-performance, professional-grade animation for the modern web
GSAP is a JavaScript library for creating high-performance animations that work in every major browser (or beyond the browser). No other library delivers such advanced sequencing, reliability, API efficiency, and tight control while solving real-world problems on over 4 million sites. GSAP works around countless browser inconsistencies; your animations 'just work'. Animate CSS properties, SVG, canvas libraries, custom properties of generic objects, colors, strings...pretty much anything! At its core, GSAP is a property manipulator, updating values over time very quickly with extreme accuracy. And it's up to 20x faster than jQuery! See the "Why GSAP?" article for what makes GSAP so special.
What is GSAP? (video)
Getting started video
Simply put, GSAP is the most robust high-performance animation library on the planet, which is probably why every major ad network excludes it from file size calculations. Unlike monolithic frameworks that dictate how you structure your apps, GSAP is completely flexible; sprinkle it wherever you want. React, Vue, Angular or vanilla JS - doesn't matter. Zero dependencies.
This is the public repository for GreenSock's JavaScript tools like GSAP and Draggable. "GSAP" describes all of the animation-related tools which include TweenLite, TweenMax, TimelineLite, TimelineMax, various plugins, extra easing functions, etc.
CDN
The TweenMax file is most popular because it has all the essential tools plus several common plugins, all in one file:
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.4/TweenMax.min.js"></script>
Click the green "Download GSAP" button at greensock.com for more options. Click "customize" at the bottom of the resulting window to see all the extra plugins and tool URLs.
Draggable, for example, is at:
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.4/utils/Draggable.min.js"></script>
Most ad networks have it on their CDNs as well, so contact them for the appropriate URL(s).
NPM
npm install gsap
The default (main) file is TweenMax which includes TweenLite, TimelineLite, TimelineMax, all of the eases (except CustomEase/CustomWiggle/CustomBounce) and the following plugins: css, roundProps, bezier, attr, and directionalRotation.
//typical import
import {TweenMax, Power2, TimelineLite} from "gsap";
//or get to the parts that aren't included inside TweenMax:
import Draggable from "gsap/Draggable";
import ScrollToPlugin from "gsap/ScrollToPlugin";
If you're having trouble getting a plugin to work, it may be that your build tool's tree shaking feature is dumping it, so try referencing it directly somewhere in your code. For import problems, try the npm path like "gsap/ModifiersPlugin". For Club GreenSock-only plugins, download them from your GreenSock.com account and then drop them into your node_modules/gsap folder or treat them as part of your own JS payload. Post other questions in our forums and we'd be happy to help.
Resources
- GSAP home page
- Getting started guide
- Full documentation
- Community forums
- Examples & showcases
- Why GSAP? (a practical guide for developers)
- Draggable demo
- Animating SVG with GSAP
- Club GreenSock (get access to bonus plugins and tools not in this repository)
- css-tricks.com article: Myth Busting: CSS Animations vs. JavaScript
- css-tricks.com article about writing smarter animation code
Get CustomEase for free
Sign up for a free GreenSock account to gain access to CustomEase which lets you create literally any ease imaginable (unlimited control points). It's in the download zip at GreenSock.com (when you're logged in).
What is Club GreenSock? (video)
Sign up anytime.
Advanced playback controls & debugging
GSDevTools adds a visual UI for controlling your GSAP animations which can significantly boost your workflow and productivity. (Club GreenSock membership required, not included in this repository).
Try all bonus plugins for free on Codepen
https://codepen.io/GreenSock/full/OPqpRJ/
Need help?
GreenSock forums are an excellent resource for learning and getting your questions answered. Report any bugs there too please (it's also okay to file an issue on Github if you prefer).
License
GreenSock's standard "no charge" license can be viewed at http://greensock.com/standard-license. Club GreenSock members are granted additional rights. See http://greensock.com/licensing/ for details. Why doesn't GreenSock use an MIT (or similar) open source license, and why is that a good thing? This article explains it all: http://greensock.com/why-license/
Copyright (c) 2008-2018, GreenSock. All rights reserved.