What is better to use ScrollTrigger.batch or gsap.utils.toArray...?
I mean performance, speed, etc...
Here are two examples of code
gsap.utils.toArray('.jsc-line').forEach(el => {
gsap.from(el, {
width: 0,
duration: 0.8,
scrollTrigger: {
trigger: el,
start: 'bottom 80%',
markers: true
}
});
});
var elms = '.jsc-line';
gsap.set(elms, {y: 20, opacity: 0});
ScrollTrigger.batch(elms, {
toggleActions: "restart none none reverse",
onEnter: batch => gsap.to(batch, {ease:"Pover1", duration: 0.3, y: 0, opacity: 1, stagger: 0.3 })
});
Thank you