romain.gr Posted September 2, 2020 Share Posted September 2, 2020 Hi, I've been trying to use ScrollToPlugin but I'm unable to install it via npm. I was on the page https://greensock.com/docs/v2/NPMUsage, but it's confusing, is the ScrollToPlugin installed when you do npm install gsap? That's how looks my import but it seems that the ScrollToPlugin is missing, and I can't figure out how to install it : import { gsap, Expo } from 'gsap/all'; import ScrollToPlugin from 'gsap/all'; gsap.registerPlugin(ScrollToPlugin); When I do gsap.to(window, { duration: 2, scrollTo: centerVidPos }); I have a console log error saying : gsap-core.js:3323 Uncaught TypeError: Failed to execute 'scrollTo' on 'Window': parameter 1 ('options') is not an object. Do I even need to register the plugin after importing it? Is there some complete documentation on the gsap website? How can I install the ScrollToPlugin via npm and how to use import/register it? Completly confused. Link to comment Share on other sites More sharing options...
ZachSaucier Posted September 2, 2020 Share Posted September 2, 2020 6 minutes ago, romain.gr said: I was on the page https://greensock.com/docs/v2/NPMUsage, but it's confusing, is the ScrollToPlugin installed when you do npm install gsap? That's the v2 installation docs. Use the v3 installation docs as that's the version you are actually importing from npm. 7 minutes ago, romain.gr said: Do I even need to register the plugin after importing it? Is there some complete documentation on the gsap website? How can I install the ScrollToPlugin via npm and how to use import/register it? Yep, it's covered in the GSAP 3 docs linked to above. If you need additional help, please make a minimal demo of the issue! Link to comment Share on other sites More sharing options...
GreenSock Posted September 2, 2020 Share Posted September 2, 2020 This looks wrong to me: // BAD import ScrollToPlugin from 'gsap/all'; // GOOD import { ScrollToPlugin } from 'gsap/all'; It looks like you were using the default export from gsap/all and assigning that to be "ScrollToPlugin" in your file. See what I mean? That would definitely be a problem 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