Function

useTimeline

Reads the timeline engine and synchronized state from React context. Use this hook inside components wrapped by `TimelineProvider` when you need to call imperative engine commands and read the latest React-rendered state in the same component. Prefer narrower hooks such as `useTimelineState`, `useTimelinePlayback`, or `useTimelineClips` when a component only needs one slice of timeline behavior.

Signature

Type Definition
useTimeline(): TimelineContextValue

Returns

Timeline context containing the shared `TimelineEngine` instance and the synchronized `TimelineState` snapshot.

Examples

tsx Example
const { engine, state } = useTimeline();
return (
<button onClick={() => engine.updatePlayhead(state.playheadTime)}>
Refresh playhead
</button>
);