How to slice along a curve and display it in 2D view in real time

In the video, I need to constantly rotate the yellow line to make sure that the yellow line is basically perpendicular to the curve, and then I can see the result I want in the sagittal view.
Is there any way to automatically set the yellow line to slide along the curve instead of a fixed straight line?
If there is a way, I can write a small script or module, but I don’t know how to implement it now.

You might be looking for ‘Cross-section analysis’ module in SlicerVMTK extension. It can take an open curve as single input and reslice a specified slice view perpendicular to the curve.