I have a div called fade and span called caption, I want GSAP to change the background color of fade and inner text of caption
This code is changing the background color of element fade but it does not do with the element caption
gsap.registerPlugin(TextPlugin);
const colors = ["black", "#4d0000", "#800000", "#330000"];
let captions=['some text','some text','some text','some text'];
const tl = gsap.timeline({ repeat: -1 });
for (let i = 0; i < colors.length; i++) {
tl.to(fade, { duration: 0.4, backgroundColor: colors[i] });
tl.fromTo(
caption,
{ text: { value: captions[i] }, opacity: 0 },
{ duration: 3.5, opacity: 1 }, "<" );
}
why the caption text is not changed although the background color is changed normally ?