Here is a quick example that takes a normalised value x (0-1) and gives a nice curved version out. In this case, map is a function that moves the input from one range [0, 1] to another [-1, 1]
function easeInOutCool(steepness, x) {
const mappedX = map(x, 0, 1, -1, 1);
return (1 + Math.tanh(steepness * mappedX)) / 2;
}
const mappedX = map(x, 0, 1, -1, 1);
return (1 + Math.tanh(steepness * mappedX)) / 2;
}
No comments:
Post a Comment