zoom() — move the view to an object

zoom() is a camera move. It zooms the score to a level and brings an object to the middle of the screen, smoothly, over a duration.

zoom(to:polaris, scale:6, dur:4)

Over four seconds the view zooms to 600% and pans until the element polaris sits in the centre.


Arguments

Argument Meaning
to id or uid of the object to centre on. Left out, the point now in the middle of the screen stays there: a plain zoom.
scale Zoom level, as in the zoom readout: 1 is the fitted score, 4 is 400%. Left out, the level stays: a pan only.
dur Seconds for the move. 0 jumps. Default 2.
ease easeInOutSine (default), easeInOutCubic, easeOutCubic or linear.
next A cue to run when the move ends — see Chaining below.
playhead follow (default): the playhead is carried along and ends on the target. <id>: it ends on that element instead. stay: the view moves alone and the playhead keeps its time.
home home:1 goes back to the normal view: zoom 1 (or scale:), the playhead where it sat before the first zoom() moved it, no pan.
delay Seconds to wait before the move starts — e.g. chained together with a ui() reveal, to let it fade in first.

trig: and uid: work as on every cue; by default the playhead fires it. trig:auto sets the opening view once the project has loaded; trig:manual keeps it off the playhead so only a next: (or a button) starts it.


The playhead comes along — or stays

By default the playhead travels with the view and ends on the target: the playback position moves to it, the playhead line slides to it on the screen, and when the move ends playback carries on from there. Whatever crosses the line next is what you are looking at — a star turning past it, the next marker. Cues it passes on the way are not fired: they count as passed, as after a seek.

playhead:<id> carries it to another element instead. On a turning sky the useful place is the pole: every star of the constellation around it crosses a line through the pole twice a turn.

playhead:stay moves the view alone. The playhead keeps its time and slides with the score, off the screen if the object is far from it; a playing score carries on from the new view, and markers further along the timeline still fire when the playhead reaches them.

zoom(to:polaris, scale:6, dur:4)                              // playhead ends on polaris
zoom(to:con-UMi, scale:16, dur:8, playhead:starmap-pole)      // view on the figure, playhead on the pole
zoom(to:polaris, scale:6, dur:4, playhead:stay)               // view only

zoom(home:1) puts the playhead line back where it sat on the screen before.

The zoom and pan are local view settings, like the toolbar zoom: every client that runs the cue makes the same move on its own screen, and a reload returns to the view you had saved.

The object is followed during the move, so something that is itself moving — a star on a rotating sky, material in a score that is playing — still ends up centred.


Chaining

A cue that knows when it has finished can hand over to the next with next:. text() and zoom() do:

text(reveal:polaris.txt, target:self, next:"zoom(to:polaris, scale:6, dur:4)")
zoom(to:polaris, scale:6, dur:4, next:"zoom(to:pole, scale:1, dur:8)")

The value is either

A text that is stopped, clicked away or replaced does not run its next.


Demo project

demo-zoom (Demos → Animation): press play and the playhead fires six red flags along the timeline —

  1. zoom(to:sec-map, scale:1.6, dur:3, playhead:stay) — an overview
  2. zoom(to:sec-poem, scale:7, dur:4, playhead:stay) — a small poem you cannot read at fit
  3. zoom(to:sec-micro, scale:20, dur:5, playhead:stay) — a spiral 34 units across
  4. zoom(to:sec-wide, scale:0.5, dur:4, playhead:stay) — the whole panorama, smaller than the screen
  5. a tour of three stars chained with next: — the default: the playhead travels with it and plays on from the last stop
  6. zoom(home:1, dur:4) — back to the normal view

①–④ leave the playhead behind so the timeline can visit each section in turn; ⑤ shows it coming along.


See also

Tip: use ← → or ↑ ↓ to navigate the docs