In May 3, Julian released Velocity. js on its GitHub. Velocity. js is a jQuery plug-in for animation switching. It implements jQuery's $. animate () method again to speed up animation switching. Velocity. js is only 7 kb in size, which not only contains $. all functions of animate () include color switching, transformation, loop, easing, CSS switching, and Scroll, it is the best combination of jQuery, jQuery UI, and CSS transformations in animation. Velocity. js supports IE8 +, Chrome, Firefox and other browsers, and supports Andriod and IOS. Velocity. js uses jQuery's $. queue () method, so it is more than jQuery's $. animate (), $. fade (), $. the delay () method is smoother, and its performance is higher than the animation attribute of CSS. For details, refer to this article.
Velocity. js contains two input parameters. The first parameter is used to specify the animation effect, and the second parameter is optional to specify additional options for the animation. The details are as follows:
1234567891011121314 |
$( "div" ).velocity({ property1: value1, property2: value2 }, { /* Default options */ duration: 400, easing: "swing" , queue: "" , complete: null , loop: false , delay: false , display: false , mobileHA: true }); |
Velocity. js also supports jQuery's parameter shorthand Syntax: $ element. velocity (propertyMap [, duration] [, easing] [, complete]):, for example:
123 |
$( "div" ).velocity({ left: 100 }, 1000); $( "div" ).velocity({ left: 100 }, 1000, "swing" ); $( "div" ).velocity({ left: 100 }, "swing" ); |
Velocity. js officially promotes Velocity's goal to become a leader in DOM animation switching. You can download the latest version of Velocity. js from here. Because the method signature of Velocity. js is the same as that of $. animate (), you only need to change the method name from animate to velocity. Several brilliant demos are provided on its official website. You can refer to them for more information.
References