- Home /
How to pass a value to ease functions with DOTween?
I want to know if there are ease functions in Dotween where you can pass a float x and return y of that. I have looked up the documentations about easing, all I found was the SetEase() method you can hang on any tweener, like this:
DoTween.To(myFloat, myFloat, targetVal, duration).SetEase(Ease.OutCirc);
but this eases the float to a targetValue over a specific duration. Instead I would like to call this every frame, something like this:
void Update(){
image.scale = InOutCirc(Time.unscaledTime * blinkSpeed); //returns y of the easeFunction at x
}
Thanks in advance.
Comment
Answer by BryceS · Feb 25, 2020 at 04:30 PM
The DOTween class DOVirtual has a few helper methods for this... Specifically DOVirtual.EasedValue, with the overload that accepts an Ease parameter.
You could use it in place of Mathf.Lerp like this:
float result = DOVirtual.EasedValue(min, max, t, Ease.InOutCirc);