Skip to main content
100%

Nunchuks

✓ Published0🌍 Public
CCurran Kelleher
Last edited May 19, 2016
Created on May 18, 2016

This example demonstrates how nested SVG `<g>` elements inherit their parent’s transform, creating a chain of rotating, scaling, and translating line segments that resembles a pair of nunchuks. The code uses D3 to append four nested groups, each one calling a function that draws a horizontal line. During animation, each group applies its own `rotate`, `translate`, and `scale` transforms via `attr`, with rotation speeds doubling at each level, while `requestAnimationFrame` drives the continuous motion.

AI-generated description

An example of the concept of nested SVG <g> elements, each having their own transform. This shows how the transforms nest such that the parent transform is applied to all children.

Built with blockbuilder.org

<!-- Start of SimpleHitCounter Code --> <div align="center"><a href="http://www.simplehitcounter.com" target="_blank"><img src="http://simplehitcounter.com/hit.php?uid=2105758&f=16777215&b=0" border="0" height="18" width="83" alt="web counter"></a></div> <!-- End of SimpleHitCounter Code -->
mit Licensed

Similar vizzes