What stack is better for creating galton board [closed]

im trying to create galton board using react.I would like the path for ball to be defined on the backend.

I was trying to use matterjs, but it a bit difficult controll ball path.Perhaps someone has already encountered something similar and can tell what stack are better or other aspects.It`s a reference to examle what i want to create (https://www.youtube.com/shorts/WkGkz_4XTjA)