# Slide show

Start a show from code, move through it, switch pens and blank the screen, and get the ink back when it ends.

Users start a show from the editor's Slide Show tab or the button at the top right. The host can also start one from the session:

```ts
const show = await session.present(0)   // from the first slide; without an argument, from the selected slide
```

The show covers the page and asks for full screen, and plays the deck's saved transitions, animations, rehearsed timings and show settings, including audio, video and trigger animations.

## Control the show

```ts
show.next()                  // plays the next animation or moves to the next slide
show.previous()
show.go(3)                   // jumps to the fourth slide
show.setTool('laser')        // pointer, laser, spotlight, magnifier, pen, highlighter, eraser
show.setInkColor('#E5484D')
show.setBlank('black')       // blanks the screen; null shows the slide again
show.close()
```

`show.index` is the current position and `show.animation` gives the animation steps played and in total on the slide. `subscribe()` notifies the host after the slide, tool or blank changes, which suits a presenter view of your own.

## After the show

```ts
const { ink, timings } = await show.closed
```

`closed` resolves when the viewer leaves or `close()` is called, with the ink drawn on each slide and the rehearsed timings (`null` when not rehearsed). When a show ends in the editor interface, the editor asks whether to keep the ink and timings; for shows started from code, the host decides what to do with them.
