playback.timelineReplay
timelineReplay(events: TimelineEvent[], config?: TimelineReplayConfig): stringReplay a sequence of timestamped graph events over time.
Each TimelineEvent carries a timestamp (ms offset from t=0), an
event type (addNode, removeNode, addEdge, removeEdge, etc.), and a
payload. Events are applied to the live graph at their relative timestamps.
Edge additions are optionally animated with AnimationsApi.edgeDraw
(controlled by config.animateEdgeDraw; default true).
Set config.loop: true to restart playback after the last event.
Not undoable. Not recorded in history.
events | TimelineEvent[] | Ordered array of TimelineEvent descriptors. |
config | TimelineReplayConfig | Optional TimelineReplayConfig (speed, loop, animateEdgeDraw). |
Returns: string
Example
const id = api.playback.timelineReplay([
{ timestamp: 0, type: "addNode", payload: { id: "s1", category: "Event", properties: {} } },
{ timestamp: 500, type: "addNode", payload: { id: "s2", category: "Event", properties: {} } },
], { loop: true });