Closed vijeeshin closed 1 year ago
Any way to scroll left based on time, i have only time parameter, right now i think its based on px
You can convert time to px by the scale
,scaleWidth
, startLeft
parameters.
First, pass these parameters to the timeline.
<Timeline
...
scale={scale}
scaleWidth={scaleWidth}
startLeft={startLeft}
/>
Then calculate the scroll left.
// where to start auto scrolling, you can customize according to the timeline panel width.
const autoScrollFrom = 500;
// scroll left
const left = time * (scaleWidth / scale) + startLeft - autoScrollFrom;
// set scroll left
timelineState.current.setScrollLeft(left)
Thanks it worked like charm
Any way to scroll left based on time, i have only time parameter, right now i think its based on px