Skip to main content
100%

Zoom Transitions

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 15, 2013

Animated grid lines on a canvas demonstrate D3’s zoom transitions, which smoothly pan and scale the view every five seconds to a new random location. The example uses `d3.behavior.zoom` with linear scales, and `transition.call` to invoke the zoom’s translate and event methods. Grid rendering relies on the Canvas 2D API, drawing vertical and horizontal lines based on the current domain, with line width scaling by zoom level.

AI-generated description

Another new feature for D3 3.3 is automatic transitions for the zoom behavior. Like the new brush transitions and earlier axis transitions, zoom transitions are initiated via transition.call. Best of all, the zoom behavior applies van Wijk and Nuij’s “Smooth and efficient zooming and panning” to preserve context while zooming!

This example jumps to a new random location every five seconds. Enjoy the trip!

gpl-3.0 Licensed

Similar vizzes