How to change a backgroundColor to a backgroundImage with GSAP while scrolling?

75 views Asked by At

I have an animation defined to the following element: parentContainerRef: gsap.to(parentContainerRef.current, { backgroundColor: "red", duration: 3,

  scrollTrigger: {
    trigger: parentContainer.current,
    start: "center top",
    markers: true,
    scrub: true,
  },
});

it doesn't work if I do the following: backgroundImage: "url('./assets/background.jpg')"

but it works if I do this: backgroundColor: "red",

0

There are 0 answers