我也为现代浏览器和旧浏览器制作了一个 slider 。我使用 translate3d 和 transition 在支持 css3 的现代浏览器中制作动画。我为旧浏览器使用 2d top、left 和 easing 函数。我从这里开始使用 css3 缓动:
http://matthewlein.com/ceaser/
我想将它转换为 javascript 函数以便在旧浏览器上使用。我知道那里有很多缓动函数,但我只想知道如何转换。可能吗?
最佳答案
您可以使用 jQuery Bez jQuery 中的 Cubic Bezier Easings 插件:
演示: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
关于jquery - 如何将 css3 过渡缓动转换为 jquery 缓动函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12449887/