tanitta/easing

Add alternative calling method

Closed this issue · 1 comments

Nearly always it's simpler to multiply the maximum value by a value from 0 to 1 instead of passing 4 arguments. So for example there should be another overload with arguments defaulting to 0, 1, 0, 1. Calling could then look like this:

vec2 position = offset * time.map!cubicInOut;

This would for example also make calling with custom types easier because you dont need to type 0, 1, 0, 1 every time.

Additionally, if you change the implementation to always assume a normalized range from 0 to 1, you can optimize your code using that and just pass modified values in the overload with arguments.

Thanks for your issue report. Based on the good idea, easing were changed that enable to call function with one value. Therefore, in case of the example, just call like this:

T eased = offset * time.easeInQubic;

Regarding optimization, I’ll give it a try later.