Signature
useTimelineTimePosition(options: UseTimelineTimePositionOptions): UseTimelineTimePositionResult<T>Type parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
T | HTMLElement | None | HTMLElement type that receives the viewport-space transform. |
Parameters
| Name | Type | Description |
|---|---|---|
| options | UseTimelineTimePositionOptions | Timeline engine, time value, and events that should refresh the transform. |
Returns
Ref and imperative updater for the positioned element.
Examples
import type { RationalTime } from '@techsquidtv/canvas-timeline-utils';import { useTimeline, useTimelineTimePosition } from '#react/hooks';
export function MarkerHead({ markerTime }: { markerTime: RationalTime }) { const { engine } = useTimeline(); const position = useTimelineTimePosition<HTMLDivElement>({ engine, time: markerTime, positionEvents: ['render', 'state:settled'], });
return <div ref={position.ref} className="marker-head" />;}