Files
clawbot/skills/remotion-prompt-video/node_modules/@remotion/web-renderer/dist/frame-range.js
T

16 lines
733 B
JavaScript

export const getRealFrameRange = (durationInFrames, frameRange) => {
if (frameRange === null) {
return [0, durationInFrames - 1];
}
if (typeof frameRange === 'number') {
if (frameRange < 0 || frameRange >= durationInFrames) {
throw new Error(`Frame number is out of range, must be between 0 and ${durationInFrames - 1} but got ${frameRange}`);
}
return [frameRange, frameRange];
}
if (frameRange[1] >= durationInFrames || frameRange[0] < 0) {
throw new Error(`The "durationInFrames" of the composition was evaluated to be ${durationInFrames}, but frame range ${frameRange.join('-')} is not inbetween 0-${durationInFrames - 1}`);
}
return frameRange;
};