Skip to main content
100%

Named Transitions II

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Dec 7, 2014

This example demonstrates how D3 3.5’s named transitions allow concurrent animations on the same SVG circles. Users toggle a position transition that moves circles vertically and a size transition that scales their radius; the “position” and “size” names prevent these transitions from interrupting each other. Unchecking the “Named Transitions” checkbox uses null names, causing the second transition to cancel the first, as seen when circles fail to complete their movement. The interactions rely on `transition.attr` with specified delays and durations, driven by button click handlers that toggle boolean state.

AI-generated description

D3 3.5 allows concurrent transitions on the same element provided the transitions have different names. Here, the “position” transition moves the circles up or down, while the “size” transition makes the circles big or small. The names allow the two transitions to work concurrently without interrupting each other.

If named transitions aren’t used, then a later transition can interrupt an earlier transition, preventing it from completing. For example, if the size transition is started shortly after the position transition, it will prevent some of the circles from reaching the end position.

gpl-3.0 Licensed

Similar vizzes