GSAP
GSAP copied to clipboard
Why does this library expose tons of globals?
Is there a version of GSAP that has everything contained within a namespace? My team won't let me use the library because they are apparently terrified of the handful of globals GSAP declares. Thanks!
Ha. That's pretty funny (well, frustrating for you I'm sure). The short answer is "yes", you can simply define a GreenSockGlobals object before you load any GSAP files and it'll attach all the globals to that one object. For example:
<script>
var gs = window.GreenSockGlobals = {};
</script>
<script src='../src/TweenLite.min.js'></script>
<script>
gs.TweenLite.to(...);
</script>
There are specific reasons we expose a lot of globals, but I suspect that's not really what you care about at this point. Let me know if you want further explanation.
Does that help?