jquery Ease Swing liner control the speed of the animation process at different times _jquery

Source: Internet
Author: User
The jquery effect function (Slideup (), FadeIn (), and so on) and the animation () function all receive another parameter that controls the speed of the animation process, which is the easing (easing), which determines the speed of the animation process at different times. For example, when you move an element across a page, you may let the element start moving slowly, then quickly, and then slow down again as the animation completes. Add ease to the animation, making the animation more visually interesting and more dynamic.

jquery contains only two easing methods: swing and linear. The linear method provides a steady animation so that each step of the animation is the same (for example, if you want an element to pass through the screen in a gradual fashion, the distance between each step is the same as the previous step). Swing is a bit more dynamic, as the animation begins to get faster and then slow down. Swing is a common setting, so if you don't specify any easing, jquery uses the Swing method.

For any jquery effect, the easing method is its second parameter, so you can write code by using the linear method to slide an element out of view:
Copy Code code as follows:

$ (' #element '). Slideup (1000, ' linear ');

When using the animate () function, the easing method is the third parameter, the first parameter is a direct amount of the object, contains the CSS attributes we want to animate, and the second parameter is the overall speed of the animation. For example, to use the linear easing method for animation code, you can write code as follows:
Copy Code code as follows:

$ (' #message '). Animate (
{
Left: ' 650px ',
Opacity:.5,
FontSize: ' 24px '
},
1500,
' Linear '
);

However, it is not limited to using the two easing methods provided by jquery. Use the jquery plug-in to add a series of other easing methods.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.