Skip to main content
100%

Looping a transition in v6

✓ Published0🌍 Public
Dd3noob
Last edited Sep 14, 2020
Created on Sep 14, 2020

A single steelblue circle loops a transition chain across a 960-by-500 SVG canvas in D3 v6. A custom `circleTransition` function appends the circle, then chains `.transition()` calls with `.duration(2000)` to move it from x-coordinate 40 to 920 and back. The `.on("end", repeat)` callback restarts the same chained movement, creating an infinite back-and-forth animation. This example demonstrates transition chaining and callback-driven repetition using d3-transition.

AI-generated description

This is a demonstration of looping transition chaining using d3.js v6.

The circle moves from left to right and then back again so that it starts and ends in the same state and then we instruct the transition code to repeat itself.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 6 of d3.js.

mit Licensed

Similar vizzes