The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
import { useMemo } from "react";
import type { TimelineElement } from "../player/store/timelineElement";
import { getEffectiveTimelineDuration } from "../player/components/timelineViewModel";
/**
* The stored `duration` lags a moment behind an edit that pushes an element
* past it (drag, trim, paste) — this is the actual end of the timeline, the
* later of the stored duration and the furthest element's end.
*/
export function useEffectiveTimelineDuration(
timelineDuration: number,
timelineElements: readonly TimelineElement[],
): number {
// Delegates to `getEffectiveTimelineDuration` rather than restating the
// arithmetic: that one guards a non-finite stored duration and a non-finite
// result (an element with NaN timing), which this copy did not — it would
// return NaN and every downstream width became NaN with it.
return useMemo(
() => getEffectiveTimelineDuration(timelineDuration, timelineElements),
[timelineDuration, timelineElements],
);
}