0 votes

I am trying to ease values in and out and the function always returns me "1"

I'm declaring some variable in the upper scope like so

var my_var = 100

then in a game loop I run

my_var = ease(my_var, 1.1)
print(my_var)  #this is always 1

am i doing this wrong? I'm on godot 3.1

asked Jan 20 in Engine by hamoom (35 points)

1 Answer

0 votes
Best answer

Having a look at the doc: https://docs.godotengine.org/en/3.1/classes/class_@gdscript.html#class-gdscript-method-ease

Not only the doc is not clear which paramerers it describes, but the function itself is unusual.
The first thing to see is that the first argument s is expected to be between 0 and 1, and the output will also be between 0 and 1, which is pretty standard for easing functions. Then you can scale or lerp after that if you want a different output range. The curve parameter however isn't obvious.

I made an issue a while ago about this function: https://github.com/godotengine/godot/issues/10572

Here is how it looks visually:
enter image description here

answered Jan 20 by Zylann (26,143 points)
edited Jan 20 by Zylann
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.