mifi / editly

Slick, declarative command line video editing & API
MIT License
4.64k stars 295 forks source link

Add time to readNextFrame, pass it to fabricImagePostProcessing #227

Closed Ivanca closed 1 year ago

Ivanca commented 1 year ago

Add time to readNextFrame, pass it to fabricImagePostProcessing, the reasoning is that video editors do most operation in seconds so thats what most users are used to, so the API should have a way to work with seconds

For example to add an animated circle that for the first 0.7 seconds of a video (regardless of the full length of the video) with this change we can do it like this:

fabricImagePostProcessing: ({image, time}) => {
  const step = Math.min(time / 0.7, 1) || 0.001; // animation takes 0.7 seconds
  image.setOptions({
    clipPath: new fabric.Circle({radius: 25 * animatedValue}),
  });
}

If approved make sure to squash the commits on merge.

Ivanca commented 1 year ago

thanks for this! i think it makes sense. only want to rename a variable

Done