
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.67 KB | hits: 11 | expires: Never
How to make animation easing (ease-in and ease-out) duration-independent?
Short animation (X milliseconds)
|<<<<|-------------------|>>>>|
10ms 10ms
Long animation (2X milliseconds)
|<<<<|-----------------------------------------|>>>>|
10ms 10ms
var $obj = $('#some-id'),
ani_dist = 500;
//animate first easing
$obj.stop().animate({ left : 100 }, 500, 'easeOutCirc', function () {
//animate main body of the animation
$obj.animate({ left : (ani_dist - 100) }, 1000, 'linear', function () {
//animate the last easing
$obj.animate({ left : ani_dist }, 500, 'easeInCirc');
});
});