block by emeeks b2cdc14617aa91c07b25

Ch. 12, Fig. 7 - D3.js in Action

Full Screen

This is the code for Chapter 12, Figure 7 from D3.js in Action which requires a touch interface (or emulator) to see any effect. This example uses data from d3.touches() to implement rotate by calculate the initial angle of the touches and rotating the SVG g element based on the current rotation of the touches.

You can see a more advanced visual explanation of how this calculation is made in this example.

index.html