如何将css3转换缓和转换为jquery缓和函数? [英] How to convert css3 transition easing to jquery easing function?
问题描述
我也为现代浏览器和旧版浏览器制作滑杆。我使用translate3d和过渡,在支持css3的现代浏览器中进行动画。我使用2d顶部,左和缓动功能旧浏览器。我在这里使用css3:
I making a slider for both modern browsers and old browsers too. I use translate3d and transition to make animation in modern browsers which support css3. I use 2d top, left and easing functions for old browser. I use css3 easing from here:
http:// matthewlein。 com / ceaser /
我想将其转换为javascript功能,以便在旧浏览器上使用。我知道有很多缓和功能,但我只想知道如何转换。
I want to convert it to javascript function for using on old browser. I know there are many easing function out there, but I just want to know how to convert. Is it possible?
推荐答案
You can use the jQuery Bez plugin for Cubic Bezier Easings in jQuery:
演示: 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
插件: https://github.com/rdallasgray/bez
这篇关于如何将css3转换缓和转换为jquery缓和函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!