3 tracks3 active clipsLayers active72 px/s
State readout preview
A small status view for tracks, active clips, selected media, and engine state.
Installation
pnpm add @techsquidtv/canvas-timeline-reactnpm install @techsquidtv/canvas-timeline-reactyarn add @techsquidtv/canvas-timeline-reactbun add @techsquidtv/canvas-timeline-react- 1
Install the package.
The command above adds the React bindings and their package dependencies.
- 2
Import from the React entrypoint.
@techsquidtv/canvas-timeline-react/hooks
Usage
import { useTimeline, useTimelineState,} from '@techsquidtv/canvas-timeline-react/hooks';
export function TimelineSummary() { const { engine } = useTimeline(); const state = useTimelineState();
return <span>{state.tracks.length} tracks</span>;}Notes
- Call these hooks inside components wrapped by TimelineProvider.
API Reference
Timeline State
Hooks for reading the TimelineEngine, state snapshot, and active layers.
Exports
context
| Name | Reference | Description |
|---|---|---|
useTimeline | API reference | Reads the shared engine and synchronized timeline state from context. |
state
| Name | Reference | Description |
|---|---|---|
useTimelineState | API reference | Reads the current reactive TimelineState snapshot. |
active state
| Name | Reference | Description |
|---|---|---|
useActiveClips | API reference | Returns clips active at the current playhead time. |
useActiveLayers | API reference | Returns active layers grouped for preview and playback surfaces. |
viewport
| Name | Reference | Description |
|---|---|---|
useTimelineViewport | API reference | Returns canonical viewport metrics and setters for custom chrome. |
useTimelineZoomScale | API reference | Subscribes to the current zoom scale without pulling the full viewport object. |
useTimelineScrollLeft | API reference | Subscribes to the current horizontal scroll offset. |
useTimelineScrollTop | API reference | Subscribes directly to live vertical scroll offset changes. |
events
| Name | Reference | Description |
|---|---|---|
useTimelineEvent | API reference | Subscribes to typed TimelineEngine events with a React-safe handler. |
geometry
| Name | Reference | Description |
|---|---|---|
useTimelineClipRects | API reference | Returns viewport-space clip rectangles for inspectors, minimaps, and custom renderers. |
useTimelineVisibleClips | API reference | Returns viewport-intersecting clips with clipped timeline and source ranges. |
useTimelineRulerTicks | API reference | Returns shared ruler tick positions and labels for custom ruler surfaces. |
useTimelineTimePosition | API reference | Projects a timeline time into viewport x-position and formatted labels. |
keyframe editing
| Name | Reference | Description |
|---|---|---|
useTimelineKeyframes | API reference | Reads clip keyframes, viewport geometry, evaluation helpers, and keyframe commands. |
useTimelineKeyframeCurves | API reference | Reads keyframe curve segment geometry, Bezier handles, and easing commands. |