Skip to main content

Spotlight

Spotlight dims the full slide except for one rectangular focus region. It is useful for walking through a diagram, interface, or sequence one area at a time.

import { Anchor, Animate, FadeIn, Spotlight, Slide } from "presenter";
const spotlight = Spotlight({  x: 820,  y: 1080,  width: 900,  height: 810,  anchor: Anchor.CENTER,  cornerRadius: 85,  opacity: 0,});
const slide = Slide({  // Put the spotlight after the content it dims  objects: [...cards, spotlight],  animations: [    FadeIn(spotlight),    Animate(spotlight, { x: 1920 }),    Animate(spotlight, { x: 3020 }),  ],});

Set the clear region with x, y, width, height, and anchor. cornerRadius rounds its corners. The alpha channel of color determines how strongly the rest of the slide is dimmed:

Spotlight({
color: Color(0, 0, 0, 0.75),
});

Place the spotlight after the content it should dim in the slide's objects array. Animate its position and dimensions to move focus between targets, or animate opacity to reveal and dismiss the entire effect.

The full list of available Spotlight properties is below:

PropertyTypeDescriptionDefault
anchorAnchorDefines which point of spotlight area sits at (x, y)Anchor.TOP_LEFT
cornerRadiusnumberAmount of corner rounding on spotlight area, in pixels50
descriptionstring | nullAccessible description of spotlightnull
heightnumberHeight of spotlight area, in pixels200
colorColorColor of dimmed regionColor(0, 0, 0, 0.8)
opacitynumberOpacity of dimmed region1
widthnumberWidth of spotlight area, in pixels200
xnumberHorizontal position of spotlight area0
ynumberVertical position of spotlight area0