I just tested a gsap.from and a gsap.to with and without opacity animation (without scrollTrigger).
For example:
useLayoutEffect(() => {
gsap.from(h1Ref.current, {
rotation: 45,
y: 200,
duration: 1,
opacity: 0, // also tested without this line
});
}, []);
All examples are working fine in production build. Maybe an issue in the scrollTrigger plugin?
EDIT: I also tested the same effect with my scrollTrigger which works fine with a gsap.to but when using the gsap.from in combination with scrollTrigger the animation doesn't get played correctly. So it might be a bug of scrollTrigger in combination with a gsap.from ?
useLayoutEffect(() => {
gsap.to(h1Ref.current, { // gsap.to is working fine, gsap.from -> not working
scrollTrigger: {
id: 1,
trigger: h1Ref.current,
start: "top bottom",
toggleActions: "play none none reverse",
},
rotation: 45,
y: 200,
duration: 1,
opacity: 0, // also tested without this line
});
}, []);