I can see that there are multiple people asking questions like this. But there is no clear answer. I've yet to find any solutions that are easily workable and that might be because I'm asking a much more difficult question then I think I am.
I'm using the jQuery UI bounce easing effect when animating to have an object(s) drop into the screen and then I'd like it to bounce only twice as if it's a heavy object and not very bouncy. Does any one know how to do this? Here is the Bounce function as it is natively in the UI, Any ideas on what variables to change and coordinate together? I've tried to figure it out on my own, but my ablities in this type of function and math logic are lacking.
Native Bounce function:
Bounce: function ( p ) {
var pow2,
bounce = 4;
while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
},
I've found other bounce functions like:
for(var a = 0, b = 1, result; 1; a += b, b /= 2) {
if (p >= (7 - 4 * a) / 11) {
return (-Math.pow((11 - 6 * a - 11 * p) / 4, 2) + Math.pow(b, 2) );
}
}
In both functions I know that "p" in it's most basic form is a percentage of how far away from your target you are.
Does anyone have any ideas?
I've also found this:
https://github.com/clark-pan/Bounce-Function
Which works really great if you wanted to add a whole bunch of extra code, and I've even figured out how to get the bounce I want out of it, but I'd rather make a custom easing that allows me to accomplish my goals. Than rewrite the bounce-function above with a whole bunch of extraneous code.
Thanks to anyone who has a solution.