Topic was automatically imported from the old Question2Answer platform.
Asked By
stefanbuettner
Hey there,
I’m trying to use a Curve to interpolated some samples in a script. I could not find a way to change the domain from [0, 1] from within the editor nor from a script. Here’s a minimal example of what I would like to have:
var myCurve = Curve.new()
myCurve.max_value = 10.0
myCurve.add_point(Vector2(0, 0), 1, 1, Curve.TANGENT_LINEAR, Curve.TANGENT_LINEAR)
myCurve.add_point(Vector2(5, 10), 1, 1, Curve.TANGENT_LINEAR, Curve.TANGENT_LINEAR)
for i in range(0, 50):
var x = i / 10.
var y = myCurve.sample(x)
print(Vector2(x, y))
I could scale my input values to [0, 1]. But I wanted to know whether there is a possibility to extend the domain of Curves and if not, why this is prohibited.
Thanks a lot,
Stefan
I guessing because Curves are normalized and 1 is 100% and 100% is max