To build a javascript game, I need a function where : $$y <= x <= z\ (\text{and } y < z)$$ $$\lim_{x\to y} f(x) = 1,\ \ \lim_{x\to z}f(x) = 0$$ with $y$ and $z$ are variables limits.
I've started with $a = 1 - (x / z)$
But I don't know how to include $y$ in that formula.
You can try this: $a={x-z\over y-z}$