Advanced transitions
This is where shit gets fun.
You can drive React state changes with D3 transitions. 🤯
The idea is that:
- Your components are a pure representation of state+props
- Change state lots and components animate
- D3 transitions are a javascript game loop inside
- Use the transition to change state, drive renders
You can build stuff like this:

But we're going to do something simpler 👉 a bouncy scatterplot.
Take your final scatterplot from before and make its size transition into smaller dimensions on click.
You'll need to:
- Change the click handling function
- Use a custom
.tweentransition to hook into D3's game loop - Use that tween to update dimension state
Here are some tips:
.tween()calls a function that should return a parametrized function- that function will get a
twhich says "We're on this frame of animation" - you can use
d3.interpolateto parametrize between 2 values - your parametrized method can update state to trigger renders 😉
Here's my final solution, I'll walk you through after you give it a shot:
