This is hard to explain but I am going to try, then I will explain it as pure mathematics.
Look at this image. So basically this is a moving line, each frame a new segment is added and the previous frame is faded by an amount decided by fps. (There are dots to make things neat but I'm not showing them for simplicity).
So based on the FPS a number is calculated (0.05 if perfect FPS ) and as a result the previous frame gets a black plane drawn over it with an opacity of 0.05.
As you can see this causes an issue because of the segments. My solution is to give each vertex a color, however I don't know how to calculate that color. The line color is defined by HSV, and the fading is decided by RGB. Furthermore I am pretty sure fading with the transparent plane creates an exponential effect, however HSV.V works linearly.
My question is if I know on a given frame that the fading plane will have an opacity of 0.05 how can I calculate an equivalent HSV color to what the previous frame will be after fading? That way the bottom two vertices can be a darker color and interpolation can fix it.
The formula that decides the opacity of the black is as follows.
(dt / (1 / 60)) * 0.5