const ctx = gsap.context((self) => {
gsap.timeline().to('#image--sunflower', {
yPercent: '+=100',
scrollTrigger: {
trigger: '#body__div',
scrub: 1,
end: 'top top'
},
})
.to('#image--sunflower', {
ease: 'linear',
rotation: 180,
scrollTrigger: {
trigger: '#body__div',
start: 'top top',
scrub: 0.5,
pin: true,
},
})
.to('#image--sunflower', {
yPercent: '+=100',
immediateRender: false,
scrollTrigger: {
trigger: '#body__div',
start: self => self.previous().end,
end: '+=100%',
scrub: 1
},
});
}, main);
Hi all again! Here with a non-technical question, how can I further abstract this code to reduce the number of lines? (Just wanna write more efficient code :))
Cheers!