GSDevTools
> advanced playback controls for GSAP
Features >
  • visual & programmatic controls
  • in & out points
  • keyboard shortcuts
  • time scale (slow/fast motion)
  • looping
  • minimal / responsive mode
  • Jump to any animation with an ID...
  • ...and everything remains synchronized!
  • Speed up your animation workflow.
  • Great for client reviews too!

GSDevTools

Your animation workflow is about to get a major boost. GSDevTools gives you a visual UI for interacting with and debugging GSAP animations, complete with advanced playback controls, keyboard shortcuts, global synchronization and more. Jump to specific scenes, set in/out points, play in slow motion to reveal intricate details, and even switch to a "minimal" mode on small screens. GSDevTools makes building and reviewing GSAP animations simply delightful.

GSDevTools

Get Started

  1. Load the JavaScript file
    //be sure to use a path that works in your dev environment
    <script src="js/gsap/GSDevTools.min.js"></script>
  2. Instantiate GSDevTools
    GSDevTools.create();

That's it! The demo below shows GSDevTools running with its default settings. It automatically gives you control over every animation on the global timeline.

Select an animation by id

Any GSAP animation (tween or timeline) can be assigned an id (a string) which causes it to show up in the animation menu. That makes it easy to jump to any scene.

Notice how the timeline and each tween below have an id assigned:

//give the timeline and child tweens their own id.
var tl = new TimelineLite({id: "timeline"})
tl.to(".orange", 1, {x: 700, id: "orange"})
  .to(".green", 2, {x: 700, ease: Bounce.easeOut, id: "green"});

//give this tween an id
TweenLite.to(".grey", 1, {x: 700, rotation: 360, delay:3, id:"grey"})

//instantiate GSDevTools with default settings
GSDevTools.create();

Now each id shows up in the animations menu (lower left).

Persistence between refreshes

For added convenience, when you manually set the in/out points, animation, timeScale, or looping state in the UI, they persist between refreshes! This means you can drag the in/out points to isolate a particular section and then tweak the code, hit refresh, and see the changes immediately within that cropped area. Any values set in the GSDevTools.create({...}) method will override manual selections. Set persist: false to disable persistence. If you encounter persistence contamination (e.g. setting timeScale in one affects another), simply assign a unique id to the GSDevTools instance (the recorded values are segregated by id, session, and domain).

Configuration options

GSDevTools can be configured extensively. Optionally define any of these properties in the config object:

  • animation [string | animation] - if you define an animation, like animation: myTimeline, animation: myTween or animation: "id", that animation will be initially selected. By default, the global timeline is selected.
  • container [string | element] - Specify the container element for GSDevTools, like: "#devTools" or document.getElementById ("devTools").
  • css [object | string] - the CSS you want on the outer div, like {width:"50%", bottom:"30px"} or a string of css like "width: 50%; bottom: 30px". It is safe to use GSAP-specific shortcuts like x, yPercent, etc. in the object syntax because it just gets passed to a TweenLite.set() internally.
  • globalSync [boolean] - by default, animations are kept in context and synchronized with the root timeline (scrubbing one scrubs them all), but you can set globalSync: false to unhook it from the global timeline. Note: only one GSDevTools instance can be globally synchronized on a page (otherwise scrubbing them both to different times would break the time-space continuum).
  • hideGlobalTimeline [boolean] - if true, the Global Timeline will be removed from the animation menu.
  • id [string] - a unique string to identify the GSDevTools instance. The persistent values between refreshes are mapped to this id, so if you ever run into a case where there's cross-contamination of the persistent values (like if you embed multiple codepens on one page and don't want timeScale changes in one to affect the others on refresh), just make sure you give each one a unique id.
  • inTime [number | string] - position of the in marker (time, in seconds, or label or animation id). You can even use relative values like "myAnimation-=2" to start 2 seconds before the animation with the id of "myAnimation". If you use just a negative relative value like "-=5"
    , it will be measured from the end of the timeline, making it easy to just watch the final 5 seconds.
  • keyboard [boolean] - if true (the default), keyboard shortcuts will work. Note: only one GSDevTools instance can listen for keyboard shortcuts.
  • paused [boolean] - initial paused state.
  • loop [boolean] - initial loop state.
  • minimal [boolean] - if true, the UI will only show minimal controls (scrubber, play/pause, and timeScale). Note: when the screen is less than 600px it automatically switches to minimal mode anyway.
  • outTime [time | label] position of the out marker (time, in seconds, or label, or animation id). You can even use relative values like "myAnimation+=2" to end 2 seconds after the animation with the id of "myAnimation" ends. If you use just a positive relative value like "+=5", it will be measured from wherever the inTime is.
  • persist [boolean] - by default, GSDevTools remembers the in/out points, selected animation, timeScale, and looping state between refreshes in the same domain session, but you can disable that behavior by setting persist: false.
  • timeScale [number] - initial timeScale.
  • visibility [string] - "auto" causes the controls to automatically hide when you roll off of them for about 1 second, and return when you move your mouse over the area again. Default is "visible", or you can set it to "hidden" to hide the controls initially (useful if you don't want the controls to obscure any part of the screen - you can still use the keyboard shortcuts to control playback or tap the "H" key to toggle visibility).

Keyboard Controls

  • SPACEBAR: play/pause
  • UP/DOWN ARROWS: increase/decrease timeScale
  • LEFT ARROW: rewind
  • RIGHT ARROW: jump to end
  • L: toggle loop
  • I: set the in point to current position of playhead
  • O: set the out point to current position of playhead
  • H: hide/show toggle

Tips and tricks

  • Clicking the GreenSock logo (bottom right) gets you right to the GreenSock docs!
  • Double-click on the in/out marker(s) to reset them both immediately.
  • If the playback UI is obscuring part of your animation, just tap the "H" key to hide it (and again to bring it back) - you can still use all the keyboard shortcuts even when it's invisible.

Advanced demos

We purposefully chose very basic animations for the demos above, but here are a few that illustrate how easy GSDevTools makes it to control and debug even super-complex animation sequences.

Requirements

GSDevTools requires TweenMax (well, actually just CSSPlugin, TweenLite, TimelineLite, AttrPlugin which are all included in TweenMax) version 1.20.3 or higher. It also uses Draggable under the hood, but in order to minimize hassle for end users, Draggable is included inside the GSDevTools file itself.

How do I get it?

GSDevTools is available to Club GreenSock members ("Shockingly Green" and above). Just download GSAP with the bonus files zip from your Dashboard.

Try GSDevTools for free on CodePen.

FAQ

  • Why is my Global Timeline 1000 seconds long?
    That means you've probably got an infinitely repeating animation somewhere. GSDevTools caps its duration at 1000 seconds. Scrubbing to Infinity is awkward.
  • Does loading GSDevTools impact runtime performance?
    Since it must monitor and record the root timeline, yes, there is a slight performance hit but probably not noticeable. Keep in mind that usually you'll only load GSDevTools while you're developing/reviewing your animations and then remove it when you're ready to launch, so ultimately it shouldn't be much of a factor anyway.
  • Why isn't GSDevTools in the CDN or Github repo?
    Because it's a membership benefit of Club GreenSock. It's a way for us to give back to those who support our ongoing development efforts. That's why we've been able to continue innovating for over a decade. See https://greensock.com/why-license for details about our philosophy.
  • Does GSDevTools work with other animation libraries?
    Nope, it depends on some unique capabilities baked into the GSAP architecture.
  • What will I do with all the time this tool saves me?
    Take up a new hobby, ponder deep philosophical questions, make cookies - it's up to you.

Get GSAP

Version: 1.20.3 updated 2017-10-02

Core

    Extras

      Plugins

        By using GreenSock code, you agree to the terms of use.

        For an all-access pass to premium content

        Join Club GreenSock