Can PathFollow2D act as a function, on a x-y axis?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Elis

Hi,

I want to animate the graph of a function in Godot. The problem is that the function I’m trying to animate doesn’t have a formula, as I plotted it with experimental values (see the picture).

Thus, I’ve tried to create a Path2D with the bezier curves to then have a child point that I could slide on the curve. Everything works great, but I’ve got a problem with the units used.

If I plotted a function, and asked for the point in the middle of the graph, it would be easy, i would have to check y[x/2]. But here, as the unit is the length of the courb, it won’t work.

the courb

Is there a way to have a relation between ‘x’ as the absciss unit and ‘l’ as the unit used by PathFollow2D, which is a fraction of the length of the courb?
Or is there another way to do what I want?

Thanks!