First, your math is wrong. d3.easeCubic(0.25)will provide you with 0.0625:
var easy = d3.easeCubic(0.25);
console.log(easy);
<script src="https://d3js.org/d3.v4.min.js"></script>
Run codeHide resultNow back to your question:
How can we reverse this, how can we find x given by known y?
, , X, Y. , , , ... , about d3.easeCubic, d3.easeCubicInOut, .
, :
export function cubicInOut(t) {
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
, , , :
function cubicInOut(t) {
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
console.log(cubicInOut(0.25))
Hide result.
, 1, :
function inverseEaseCubic(t){
return Math.cbrt(t * 2) / 2;
}
. 0.0625 , 0.25:
function inverseEaseCubic(t){
return Math.cbrt(t * 2) / 2;
}
console.log(inverseEaseCubic(0.0625))
Hide result1, :
function InverseEaseCubic(t){
return t <= 1 ? Math.cbrt(t * 2) / 2 : (Math.cbrt(2 * t - 2) + 2) / 2;
}
PS: , @altocumulus , . . , :
function exponentiation(a){
return a*a;
}
, 4. ? ? , , , 2 :
console.log(exponentiation(2))
console.log(exponentiation(-2))