Yep, as Rodrigo pointed out, there are several problems:
You forgot to load/register the ScrollToPlugin (you only did ScrollTrigger).
You didn't pass an empty dependency array to your useEffect(), so React will call that again and again on every render.
You aren't doing proper cleanup. I'd strongly recommend using gsap.context() to make it very easy. Read this article:
You were passing a position parameter ("<0.5") to a normal tween which is invalid. That's only for when you're placing something into a timeline. I'm not exactly sure what you were trying to accomplish there, but if you want to make the animations delay their start time for 0.5 seconds, just set delay: 0.5 in your tween(s).
You used a capital "P" in "Power4.out" which is incorrect. It should be "power4.out" or just "power4" because "out" is the default type.
So your code could look like:
import gsap from "gsap";
import { ScrollTrigger } from 'gsap/dist/ScrollTrigger';
import { ScrollToPlugin } from 'gsap/dist/ScrollToPlugin';
gsap.registerPlugin(ScrollTrigger, ScrollToPlugin); // (or in the top-level file in your React app)
useEffect(() => {
let ctx = gsap.context(() => {
gsap.to(".scroll_footer_section", {
duration: 0.2,
bottom: 50,
delay: 0.5
ease: "power4.out",
});
gsap.to(window, {duration: 2, scrollTo: 400, delay: 0.5});
});
return () => ctx.revert(); // <-- cleanup!
}, []); // <- empty dependency Array
I hope that helps.