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 is120
(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 ofauto
GSAP itself determines when to animate the tween using the GPU. Setting this property tofalse
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 totrue
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 defaultx: 10
moves an element by 10 pixels. If you wanted to make it so thatx: 10
moved it by 10% instead you could definegsap.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.