I use GSAP 3.6.0 and I would like to know how can I create a duration on my elements.
I have two cube, red and blue :
import gsap from './gsap'
import ScrollTrigger from './ScrollTrigger'
gsap.registerPlugin(ScrollTrigger)
const tl1 = gsap.timeline();
tl1.to('.cube.red', {
duration:2, y:100, ease:"linear",
scrollTrigger: {
trigger:"#intro",
markers:true,
start: "0",
pin: "#intro",
//end: '+=1',
scrub:0,
}
})
tl1.to('.cube.blue', {
duration:1, y:100, ease:"linear",
scrollTrigger: {
trigger:"#intro",
markers:true,
start: "0",
pin: "#intro",
//end: '+=4',
scrub:0,
}
})
When I scroll, the red cube and the blue cube move together. But I set a different duration.
The red cube has a duration equal 2, and the blue cube has a duration equal 1.
When I scroll, the red cube must move less quickly, but the two cubes move at the same speed...