Animating Family Trees, a la Pachinko

In musing on how a family tree is kind of like Pachinko, I wondered if this could be animated somewhat like a Pachinko machine in the family tree visualization I have been playing with (available at https://learnforeverlearn.com/ancestors).

I took some first steps towards this by pulling out the Bezier curve parameters d3 is generating for the links between nodes, coupled with Particle in Cell's notes on computing the intersection between Bezier curves and a line , to make some first steps towards a Pachinko-like animation effect. Some details on this implementation are at the bottom of this note.

A few youtube videos demonstrating this are below.
You can also go directly to the interactive visualization with the tree for Charles II of Spain automatically loaded via this link, and clicking the "Do Pachinko" button.

While I still need to play with the timing and smoothness, it is nevertheless interesting to watch the animations play over and over, reflecting on the huge number of things that had to happen (or not happen) through the centuries to result in me being here today.

Equations to be Solved to Find the Coordinates of the Animated Circles

Shown below is an example of a curve displayed on the screen and the svg path generated by d3:

and then using that $\hat{t}$ to find the $x$ coordinate $\hat{x}$ of the intersection. The center of the animated circle is then $(\hat{x},\hat{y})$.
The cubic equation can be solved exactly (some preprocessing is done using the parent and child birth years to ensure that the line at year $y$ passes through the curve) - but there's some potential tedium dealing with multiple roots. The root-finding implementation in this visualization, from Particle in Cell, is originally from Stephen Schmitt (this was apparently on a Verizon personal web space site that no longer exists).

There are optimizations I need to address with respect to quickly finding the paths intersecting a given point in time, but it seems to work ok on small to moderately-sized trees.

The purpose of this page is to summarize in one place some of the interactive visualizations I have worked on. Most of these were built...

"When you start on your journey to Ithaca, then pray that the road is long, full of adventure, full of knowledge... Always keep Ithaca fixed in your mind. To arrive there is your ultimate goal. But do not hurry the voyage at all." (from "Ithaca", by C. P. Cavafy)