我也为现代浏览器和旧浏览器制作了滑块。我使用translate3d和transition在支持css3的现代浏览器中制作动画。我对旧浏览器使用 2d 顶部、左侧和缓动功能。我从这里使用 css3 缓动:
http://matthewlein.com/ceaser/ http://matthewlein.com/ceaser/
我想将其转换为 javascript 函数以便在旧浏览器上使用。我知道有很多缓动函数,但我只想知道如何转换。是否可以?
您可以使用jQuery 贝兹 https://github.com/rdallasgray/bezjQuery 中的三次贝塞尔曲线缓动插件:
Demo: http://jsfiddle.net/SO_AMK/sbZ7a/ http://jsfiddle.net/SO_AMK/sbZ7a/
jQuery:
$("#box").click(function() {
$(this).animate({
"margin-left": 200
}, 2000, $.bez([0.685, 0.595, 0.020, 0.720]));
});
// Take the Ceaser output and put the values in, in order, like above. i.e. cubic-bezier(0.685, 0.595, 0.020, 0.720) would end up as the above value
Plugin: https://github.com/rdallasgray/bez https://github.com/rdallasgray/bez
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)