hello
I am new to greensock and i have a doubt ... I am trying to add a class every time i scroll inside a section within a loop.
Works correctly with the toggleclass but it's not what i need ...
gsap.utils.toArray(".section-animated-text").forEach((section: any) => {
const tls = gsap.timeline({
scrollTrigger: {
trigger: section,
start: "top 30%",
markers: true,
toggleClass: "section-animated-text-start",
},
});
});
i've tried multiple ways but it doesn't work for me
gsap.utils.toArray(".section-animated-text").forEach((section: any) => {
const tls = gsap.timeline({
scrollTrigger: {
trigger: section,
start: "top 30%",
markers: true,
},
css: {
className: "+=section-animated-text-start"
}
});
});
gsap.utils.toArray(".section-animated-text").forEach((section: any) => {
const tls = gsap.timeline({
scrollTrigger: {
trigger: section,
start: "top 30%",
markers: true,
},
onStart: titleVisible,
});
function titleVisible (){
// do stuff
}
});
anyone have any ideas?