Home >Web Front-end >JS Tutorial >jquery easing swing liner controls the speed at different moments of the animation process_jquery
Both the jQuery effect function (slideUp(), fadeIn(), etc.) and the animation() function receive another parameter used to control the speed of the animation process, which is easing, which determines the speed of the animation process at different moments. For example, when moving an element across the page, you might have the element start moving slowly, then become very fast, and finally slow down again as the animation completes. Add easing to animations to make them more visually interesting and dynamic.
jQuery only contains two easing methods: swing and linear. The linear method provides a stable animation so that each step of the animation is the same (for example, if you want an element to move across the screen in a gradually changing manner, each step is the same distance as the previous step). The swing is more dynamic, getting faster at the beginning of the animation and then slowing down. swing is a common setting, so if no easing is specified, jQuery will use the swing method.
For any jQuery effect, the easing method is its second parameter, so to use the linear method to slide an element out of view, you can write the code like this: