Animation
✓ Published0🌍 Public
RRobinL
Last edited Jul 14, 2013
Created on Jul 14, 2013
This example demonstrates the stark contrast between animated and static SVG rendering. The code appends a simple rectangle to the SVG canvas and repeatedly updates its x-coordinate with `setTimeout`, incrementing a counter every 10 milliseconds to create an infinite horizontal slide. Three linked versions allow comparison: one animates continuously, while two alternatives remove the update loop, leaving the rectangle fixed in place. The visualization uses raw D3.js selection and attribute methods (`svg.select("rect").attr`) rather than higher-level transition helpers, highlighting the fundamental mechanism behind frame-based movement in D3.
AI-generated description