Skip to main content
100%

JavaScript Arrays

✓ Published1🌍 Public
Rraturi22@gmail.com
Last edited Aug 8, 2025
Created on Aug 7, 2025

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 description
MIT Licensed

Similar vizzes