xzdarcy / react-timeline-editor

react-timeline-editor is a react component used to quickly build a timeline animation editor.
https://zdarcy.com/
MIT License
284 stars 82 forks source link

Is there any way for the time not to start at 0? #36

Open mcosti opened 7 months ago

mcosti commented 7 months ago

Hey! Awesome library, thank you for your work.

Did anyone figure out a way for the timeline to start at negative values?

My use case is syncing an audio offset which would great improve my UX if it would be possible for the timeline to start at negative values. Right now what I did is I pushed both actions more to the right so there is a virtual offset, but it requires quite a lot of effort in synchronizing it with a videoplayer.

Thanks

mcosti commented 7 months ago

Kind of answered my question, at least for my use case:

Adding minStart on the action as a negative value works

zane-programs commented 6 months ago

Nice! Here's how I did it in my use case by using the getScaleRender prop:

// ...

function getScaleRender(scale: number) {
  return <>{scale + 1}</>;
}

// ...

function TimelineComponent() {
  // ...
  return (
    <Timeline
      // ...
      getScaleRender={getScaleRender}
    />
  );
}