I am familiar with the jQuery animate function and I have also gone through the various jQuery UI easing functions. Unfortunately none of them appear as the same animation effect I'm looking for so is it possible to create your own easing functions?
The animation I am attempting can be seen on the Apple Mac webopage with the dynamically loaded products widget at the top. The initial items appear to slide in from the top and then give a bounce-back effect after landing in place. Is it possible to recreating this easing style using custom jQuery code? Or possibly build your own 3rd party easy functions?
I've included a screen of what I'm talking about and hopefully somebody can offer a solution. Thanks in advance :)
An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing , and one that progresses at a constant pace, called linear .
The jQuery animate() method is used to create custom animations.
Syntax. Required. Specifies one or more CSS properties/values to animate. Note: The property names must be camel-cased when used with the animate() method: You will need to write paddingLeft instead of padding-left, marginRight instead of margin-right, and so on.
The animate() method is typically used to animate numeric CSS properties, for example, width , height , margin , padding , opacity , top , left , etc. but the non-numeric properties such as color or background-color cannot be animated using the basic jQuery functionality. Note: Not all CSS properties are animatable.
See my demo here
The main idea is performing 2 continuous animations using easeOutCubic effect:
HTML:
<div class='left'></div>
<div class='center'></div>
<div class='right'></div>
JS:
$('div.left').animate({top: 410, left: 10}, 300, "easeOutCubic", function(){
$('div.left').animate({top: 400, left: 20}, 300, "easeOutCubic");
});
$('div.center').animate({top: 420}, 300, "easeOutCubic", function(){
$('div.center').animate({top: 400}, 300, "easeOutCubic");
});
$('div.right').animate({top: 410, right: 10}, 300, "easeOutCubic", function(){
$('div.right').animate({top: 400, right: 20}, 300, "easeOutCubic");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With