I really need help to figure out on how to use these easing functions I found on this helpful website: https://spicyyoghurt.com/tools/easing-functions
I know what the values that the function needs means, I created a function in one of my classes that helps me get the current time (t) to pass it to the function afterwards:
getEaseTimeVar()
{
var timeStamp = performance.now();
this.#secondsPassed = (timeStamp - this.#oldTimeStamp) / 1000;
this.#oldTimeStamp = timeStamp;
return timeStamp;
}
(EXPLANATION) This function works, but only if it is called at the beginning of the code execution. For example, if I want to fade something in (value from 0 to 1) using a linear easing function and call it at the beginning of code execution, it would increase and even go beyond 1, which is fine, that's normal. However, if I want to do the same thing, but I want it to start say 5 seconds after code execution, it will not start at 0, but jump to a larger value.
(PROBLEM) This is because I think I am not getting the time at which the animation starts, but from the start of all code execution, and I am struggling to understand how to do this while still maintaining a simple function to use the easing animation.
Thank you in advance for your help.