Skip to main content

createCanvasHoverController()v4.0.527

Creates a standalone CanvasHoverController. createCanvasController() already creates one at controller.hover; use this function when hover has a separate lifetime.

warning

Experimental API: This package is not stable. Its public API may change without a major version bump.

hover.ts
import {createCanvasHoverController} from '@remotion/sdk'; export const hover = createCanvasHoverController(); hover.clear(null);

The function takes no arguments. The initial snapshot is null. Read and subscribe with useCanvasHover(), or use getSnapshot() and subscribe(listener) outside React.

Methods​

setHoveredSequence()​

Accepts a CanvasHover value, null, or an updater function. A CanvasHover has key for the instance, nodePathKey for the source node, and source ('canvas' or 'timeline'). Identical values do not emit an update.

clear()​

clear('canvas') or clear('timeline') clears hover only when it came from that source. clear(null) clears hover regardless of source.

getSnapshot()​

Returns the current CanvasHover or null.

subscribe()​

subscribe(listener) calls listener after a hover update and returns an unsubscribe function.

Compatibility​

BrowsersEnvironments
Chrome
Firefox
Safari

See also​