I am just trying to implement things out but not getting animations as expected. Any help will be appreciated.
There is an animation which will have a component which will scale from large to 1 , therefore used .from and then it will translate to left and be out of viewPort, thus using .to . Now as soon as this completes, I want to fire another animation of exactly similar nature but the only change is the contents inside the component. Therefore I added them in the same timeline. But now only .from animation is fired for every component and .to doesn't (at least it is not visible). I want to fire the animation of another component just after finishing the .to animation.
Attaching the code if it is helpful.
const t1 = gsap.timeline({
scrollTrigger: scrollTriggerOptions,
});
//for o
t1.from(ref1.current, {
scale: 17,
opacity: 0,
})
.to(ref1.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref1.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(refo.current, {
opacity: 1,
width: '15.4%',
});
//for f
t1.from(ref2.current, {
scale: 17,
opacity: 0,
})
.to(ref2.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref2.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(reff.current, {
opacity: 1,
width: '10.7%',
});
//for e
t1.from(ref3.current, {
scale: 17,
opacity: 0,
})
.to(ref3.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref3.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(refe.current, {
opacity: 1,
width: '10.7%',
});
//for r
t1.from(ref4.current, {
scale: 17,
opacity: 0,
})
.to(ref4.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref4.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(refr.current, {
opacity: 1,
width: '12.7%',
});
//for t
t1.from(ref5.current, {
scale: 17,
opacity: 0,
})
.to(ref5.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref2.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(reft.current, {
opacity: 1,
width: '11.6%',
});
//for a
t1.from(ref6.current, {
scale: 17,
opacity: 0,
})
.to(ref6.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref6.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(refa.current, {
opacity: 1,
width: '14.4%',
});
//for 2
t1.from(ref7.current, {
scale: 17,
opacity: 0,
})
.to(ref7.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref7.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(refl2.current, {
opacity: 1,
width: '11.3%',
});
//for 4
t1.from(ref8.current, {
scale: 17,
opacity: 0,
})
.to(ref8.current, {
translateX: '-100%',
// opacity: 0,
scrollTrigger: {
trigger: ref8.current,
// pin: ref1.current,
start: '58% 50%',
end: '60% 50%',
scrub: true,
markers: true,
},
})
.to(refl4.current, {
opacity: 1,
width: '12.4%',
});
Attaching the video preview . Since I have coded in react, I find it difficult to display in codepen.io .(In case anyone is able to help me with this as well )
WhatsApp Video 2024-02-22 at 18.39.10-2.mp4