JavaScript Arrays
✓ Published1🌍 Public
This example shows a looping animation of fifteen circles moving in a sine-wave pattern across an SVG canvas. The circles are generated and repositioned every 50 milliseconds using `setInterval`, with each circle’s vertical position calculated from `Math.sin(d * 0.5 + t)` and multiplied by 220. The code uses `d3.select`, `d3.range`, and the `.join` method to bind incoming data to existing SVG elements, while `d3.attr` updates the `cx` and `cy` coordinates. The animation runs indefinitely, with `t` incrementing by 0.1 each frame to create the wave effect.
AI-generated descriptionMIT Licensed