Skip to main content
100%

Looping a transition in v4

✓ Published0🌍 Public
Dd3noob
Last edited Dec 30, 2016
Created on Dec 30, 2016

A steelblue circle loops horizontally across a 960-pixel-wide SVG canvas, moving right for two seconds and then left for two seconds in a continuous cycle. The example demonstrates d3-transition chaining in d3.v4 using `.transition()` and `.duration()` to animate the `cx` attribute, with the `on("end")` event triggering the repeat function. This serves as a starting template for building more complex looping animations in D3 version 4.

AI-generated description

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

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 4 of d3.js.

Similar vizzes