Skip to content

🎥 Make videos programmatically with React

816 B
Raw Blame
import type {TimelineTrackData} from '../../helpers/get-timeline-sequence-sort-key';

// A track is shown in the timeline list when:
// - The sequence opted-in via `showInTimeline` (the default).
//   Children of a sequence with `showInTimeline: false` keep being listed
//   on their own; their depth is independently flattened by
//   the timeline calculator so the parent does not contribute an indent.
// - The sequence has a positive duration.
// - The sequence starts before the composition ends.
export const shouldShowTrackInTimeline = (
	track: TimelineTrackData,
	durationInFrames: number,
): boolean => {
	if (!track.sequence.showInTimeline) {
		return false;
	}

	if (track.sequence.duration <= 0) {
		return false;
	}

	if (track.sequence.from > durationInFrames) {
		return false;
	}

	return true;
};