DeepZoom scripting

What can be scripted?

DeepZoom allows you to add events to a trip and or route and trigger them at specific times. Events fall into five main categories.

  • animation control
  • map appearance
  • route properties
  • branding
  • display of ancillary web pages or media

example, displaying marinas at the end of each route:

https://www.deepzoom.com/trip/yzp5ybrk

before, during, and after

When you hit the play button in DeepZoom, or alternatively when you drag the time slider, events associated with the trip are triggered.

Events are associated with one of three groups, corresponding to the before, during, and after tabs in the script dialog.

Events are attached to either a trip or to a route, depending on the trip / route toggle.

event type before during after
trip once during trip end of trip
route start of route during route end of route

Trip Events

Before trip events affect the starting conditions for the trip, and are a good place to put layer selection, opacities, playback rate, and timebase settings. When you save a trip with "Include view settings" set to Yes, all of these settings are saved for you automatically.

During trip events are triggered when a specified portion of the trip is complete. This is a relative measurement (0-1). In general, it's better to use route during events instead of trip during events since these relative offsets are less likely to be affected by changes in the overall trip containing multiple routes.

After trip events are triggered each time the trip animation completes. Finally, the loopcount variable is incremented, which can be used change properties on even/odd or every nth pass through the trip.

Route Events

Before route events affect the starting conditions for the route.

During route events are triggered when a specified portion of the route is complete. This is a relative measurement (0-1). In general, it's better to use route during events instead of trip during events since these relative offsets are less likely to be affected by changes in the overall trip containing multiple routes.

After route events are triggered each time the route is completed.

Relative events

The during event are a linear measurement of relative progress through either a trip or route, expressed as a value of 0 to 1.

Note that the "Δt" button in the script dialog let's you re-assign the relative position for all selected events after dragging the slider.

Adding Events

Follow this sequence when adding events:

  1. Stop animation.
  2. Select either trip or route using the toggle. If route, select the name of the route.
  3. Select the appropriate tab, either "before", "during", or "after".
  4. Move the time slider to the time when you want the event to activate.
  5. If appropriate, perform the action you want to record in DeepZoom. Like select a current station, or select a marker, or choose a tab.
  6. From the event list, select the corresponding event to record and then press "+".
  7. If necessary, edit the event. For example if using the notify event, fill in the text to display.
  8. Test triggering the event by dragging the time slider back and forth.

if conditional and loopcount

Any event can include a conditional if clause. For example, to trigger an event only on even or odd passes, add the following "if" property to any event

"if": "loopCount % 2 == 0" // all even loops
or
"if": "loopCount % 2 == 1" // all odd loops

the info stack

Multiple web pages or media can be added to the info page arranged in a stack. See the info infoUrl event for inspiration.