I have these two animations, a box rotating and contact buttons popping onto the screen.
ScrollTrigger.create({
trigger: "#topLetterTrigger",
animation: gsap.fromTo("#topLetter", {rotateY: -180}, {duration: 2.2, rotateY: 0, ease: "back.out(1.7)"}),
once: true
});
gsap.set(".contact-icon", {scale: 0});
ScrollTrigger.batch(".contact-icon", {
trigger: "#topLetterTrigger",
interval: 3,
batchMax: 4,
once: true,
onEnter: batch =>
gsap.to(batch, {delay: 0.5, duration: 0.8, scale: 1, stagger: {each: 0.25, grid: [1, 4]}, overwrite: true, ease: "back.out(1.7)"}).delay(1.4),
});
The delay on the batch animation is supposed to make the animations end at roughly the same time. However it doesn't, it seems sometimes the second trigger doesn't fire, or it starts the second animation when the first animation has completed, so instead of completing together the second animation commences at the end of the 1st animation + 1.4 second delay.
Note: is there an issue where you shouldn't have 2 animations given the same trigger: value?
I think using a timeline and the ScrollTrigger-ing them both will make it more robust.
Or there is some other better way?