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 { useTimelineEngine, useTimelineState,} from '@techsquidtv/canvas-timeline-react/hooks';
export function TimelineSummary() { const engine = useTimelineEngine(); 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
state
| Name | Reference | Description |
|---|---|---|
useTimelineSelector | API reference | Selects primitive or object values from readonly settled state with configurable equality. |
useTimelineState | API reference | Reads the current reactive TimelineState snapshot. |
context
| Name | Reference | Description |
|---|---|---|
useTimelineEngine | API reference | Reads the stable engine without subscribing to state changes. |
useTimeline | API reference | Reads the shared engine and subscribes to the timeline state 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. |
useTimelineViewportBounds | API reference | Observes content, scroll, and zoom limits as content, dimensions, or policy change. |
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. |
geometry
| Name | Reference | Description |
|---|---|---|
useTimelineTrackGeometry | API reference | Shares reactive viewport-space row geometry across consumers with the same layout. |
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 | Updates a DOM element transform imperatively from timeline time. |
events
| Name | Reference | Description |
|---|---|---|
useTimelineEvent | API reference | Subscribes to typed TimelineEngine events with a React-safe handler. |
keyframe editing
| Name | Reference | Description |
|---|---|---|
useTimelineKeyframes | API reference | Reads settled clip keyframes, selection, evaluation helpers, and keyframe commands. |
useTimelineKeyframeGeometry | API reference | Reads live keyframe rectangles scoped by clip and property for custom overlays. |
useTimelineKeyframeSegments | API reference | Reads keyframe segment geometry, Bezier tangent handles, and side commands. |