Jump to content

gsap.config is useful for changing GSAP’s settings globally. General settings that are not inherited by individual tweens go in the config object. Any properties that should be inherited by individual tweens should go in gsap.defaults() instead. Here is a full list of possible options that you could specify:

  • autoSleep - Determines how many frames go by before garbage collection occurs. The default is 120 (about every 2 seconds).
  • force3D - force3D allows you to control how often tweens that could use the GPU use the GPU. When this property is the default of auto GSAP itself determines when to animate the tween using the GPU. Setting this property to false makes it so that GSAP never adds tweens to the GPU for you (unless you specifically tell a tween to use a 3D value). Setting this property to true will make it so that GSAP forces all tweens that can use the GPU to use the GPU. However, this is not recommended because using it too much can cause a performance hit, especially on larger elements and large images. If used sparingly it can increase smoothness and performance of the animation. The default is "auto".
  • units - This property allows you to set the default unit for numbers for given properties. For example, by default x: 10 moves an element by 10 pixels. If you wanted to make it so that x: 10 moved it by 10% instead you could define gsap.config({units: {x: "%"}}). Only the properties that you set will be changed. The default for most numbers is "px" but some are "deg" depending on which property you’re talking about.
Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.