You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more
I need to animate a DIV sliding left to right, but I want it to overshoot.
I have a variable, for the sake of argument X, that increments between 0 and 1 to represent the percentage complete. This is then used to multiply a second variable that holds the total distance that needs to be moved to create the animation.
I'd like to be able to pass X to a function that returns 0 when passed 0, 1 when passed 1, but at some point (around 0.85) over shoots 1. I hope that makes sense.
Can any point me in the direction of a suitable equation.
Thanks.
something like
function incX(x)
{
if(x == 1){
return 1
}
if (x==0){
return 0
}
return (1.29 * x)
}
That syntax is probably wrong but its been a while since I've done javascript.
Don't reinvent the wheel. Use JQuery.
I've worked it out now. Can't use JQuery.