Skip to main content
100%

Transform Transitions II

✓ Published0🌍 Public
Mmbostock
Last edited Feb 26, 2016
Created on Feb 26, 2016

A grid of 1,200 small colored squares, each assigned a position via inline CSS `transform` and a hue from `d3.hsl`, reacts to mouseover by flying to the center of the viewport. The selected square scales up and rotates 180 degrees using D3’s `transition().style("transform")`, which interpolates the CSS transform string, then shrinks and removes itself. Built with d3.v4 and `d3.range`, the animation leverages D3’s transform interpolation to smoothly tween translate, scale, and rotate values, while `raise()` brings the active square to the front.

AI-generated description

D3 4.0 can now interpolate CSS transforms!

gpl-3.0 Licensed

Similar vizzes