I want to increase or decrease a variable in a exponential or speeding up manner in a piece of code that happens every frame.
This code gets executed every frame:
if (animationLenght > 1) {
animationLenght --
// implement speeding up value
...
}
Doesn't have to be exponential exactly but like that it accelerates (or decelerates)
The animation variable decreases linearly by one on every frame.
I want to increase or decrease a value in an non linear fashion, but like speeding up or slowing down smothly.
Any ideas?
You can check the Math.exp() function: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math/exp
let expNum;
for(let i=0; i < length; i++){
expNum = Math.exp(i)
}