Navigation selection state changes upon scroll?

Hi! I’m trying to build a prototype in a similar vein to this or this.

Basically I’m trying to create a dynamic interaction between individual nav items variant states and the user’s scroll position on a one page doc (and vice versa).

Is something like this possible? I know the latter is with “On-Click > Scroll To” but It doesn’t seem like Figma has this capability for the former. If anyone could point me in the right direction for a solution outside of Figma as well that would be much appreciated!