Funhyun Posted July 29, 2022 Share Posted July 29, 2022 Hi GSAP experts!  I am new in developing GSAP. In general, do I need to add registeredPlugin codes after the first line of code in the JS file? Any advice is greatly appreciated. Thanks in advance! 😀  import gsap from 'gsap'; // Is this code below needed if I want to use ScrollTrigger and ScrollSmoother plugins? gsap.registerPlugin(ScrollTrigger, ScrollSmoother);  Link to comment Share on other sites More sharing options...
Kaleb242 Posted July 29, 2022 Share Posted July 29, 2022 That's the idea. You can also set gsap.defaults before gsap.registerPlugin too... My first few lines on a typical GSAP project are: 'use strict'; gsap.defaults({overwrite: "auto"}); gsap.registerPlugin(CSSRulePlugin, ScrollToPlugin, ScrollTrigger, TextPlugin); 2 Link to comment Share on other sites More sharing options...
Kaleb242 Posted July 29, 2022 Share Posted July 29, 2022 https://greensock.com/docs/v3/GSAP/gsap.registerPlugin() Link to comment Share on other sites More sharing options...
Funhyun Posted July 30, 2022 Author Share Posted July 30, 2022 Thank you for your reply! Have a great weekend! 😀 Link to comment Share on other sites More sharing options...
iDad5 Posted July 30, 2022 Share Posted July 30, 2022 I cannot find where I did it, but im rather sure I used registerPlugin in conditional statements in various places without problems. I usually do not use build tools though (for a lot of reasons) and as I make sure to load gasp and the plugins in the correct order registerPlugin is redundant for me in most cases anyhow.  My understanding however is that usually there should b no need to place registerPlugin always on top as long as you register the plugin before you use it - if it is necessary, but I giving my limited experience with build tools I might be wrong and would happily hear form those who are in the know - and also surely it is nothing wrong with registering at the start of a JS file as a convention. 1 Link to comment Share on other sites More sharing options...
Dodaxx Posted July 30, 2022 Share Posted July 30, 2022 what tech do you use? Link to comment Share on other sites More sharing options...
iDad5 Posted July 30, 2022 Share Posted July 30, 2022 @Dodaxx Are you asking me? Link to comment Share on other sites More sharing options...
Dodaxx Posted July 30, 2022 Share Posted July 30, 2022 @iDad5Â no , I ask the question to Henry. Â 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now