jQuery UI 'easeoutbounce' needs to be more bouncy

╄→гoц情女王★ 提交于 2019-11-30 21:17:21

问题


I've created a div which drops to the bottom of the screen on click. It needs to bounce, so I've used 'easeOutBounce' as the ease effect. It works nicely but the client has requested that it's "more bouncy". I know I can slow the animation down but I don't really want the object to move more slowly, I just want it to bounce more. Less gravity, I suppose.

Here's the jQuery:

$( document ).click(function() {
    $( "div" ).animate({ top: 400 }, { duration: 2000, easing: 'easeOutBounce' });
});

And here's a fiddle: http://jsfiddle.net/NtkNB/1/

I'm really struggling to find documentation on this specific effect and wondered if anyone could suggest either how to configure the current set-up to get the desired effect or alternatively if there are any more advanced animation effects around that would do this which I could plug-in.

Thanks


回答1:


This question is old, but it doesn't appear to have been answered. Happened across it because I had the same issue only opposite (div needed to be 'less bouncy'). The solution I came up with was a quadratic equation to govern each bounce (maybe not the most elegant). Here is a jsfiddle: http://jsfiddle.net/NtkNB/194/ This one is less bouncy than the default jquery animation. To make it more bouncy, you will just have to change the equation, which is kind of a pain.

var thing = (-17.34*x*x)+(14.351*x)-2.944;

I used wolfram to determine: http://www.wolframalpha.com/input/?i=quadratic+through+%28.343%2C0%29%2C%28.4715%2C.1%29%2C+%28.6%2C0%29



来源:https://stackoverflow.com/questions/14707605/jquery-ui-easeoutbounce-needs-to-be-more-bouncy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!