Hey. Thank you so much for guiding me in the right way. I did it all in codepen. But, when I started to transfer this structure to the angular, I encountered a problem.
I installed gsap 3 and am trying to remake my code for version 3 of gsap. I can’t understand why the progress is not being updated, why during the drag the line stands still.
I think this should not be affected by the fact that I do not use throwProps
what could be the problem?
gsap.set( tickerWrapper , {x: -tickerWrapperWidth } );
const initDuration = tickerWidth / this.speed;
const loopDuration = tickerWrapperWidth / this.speed;
let transformX;
const tl: TimelineMax = new TimelineMax({repeat: -1 });
tl.to( ticker , 0 , {
x: -tickerWrapperWidth,
ease: Power0.easeNone
} );
tl.to( ticker , loopDuration , {
x: -tickerWrapperWidth * 2 ,
ease: Power0.easeNone,
onUpdate: () => {
// console.log('onUpdate= ', tl.progress());
}
} );
Draggable.create(tickerWrapper, {
type: 'x',
trigger: ticker,
onPressInit: () => {
tl.pause();
},
onDrag: () => {
transformX = (gsap.getProperty(ticker, 'x') + tickerWrapperWidth) % tickerWrapperWidth;
tl.progress(Math.abs(transformX) / tickerWrapperWidth);
},
onDragEnd: () => {
transformX = (gsap.getProperty(ticker, 'x') + tickerWrapperWidth) % tickerWrapperWidth;
tl.progress(Math.abs(transformX) / tickerWrapperWidth);
tl.resume();
console.log('onDragEnd');
},
});