Css3: Create loading animation effects during loading

Source: Internet
Author: User

The common loading usually uses a GIF to achieve the animation effect. In fact, we can use the css3 feature to make it. This article introduces a method for making css3 with Linear Loading effect.

Ajax loading is often encountered in Web development. Do you use GIF to load the icons?
By the way, there is a tool website that customizes the small icon of the loader GIF. Click here to view

This article introduces a linear style loading style. Click here to view the demo

We all know that the essence of an animation is that a frame of a vibrating screen is played in sequence, so we have the following design ideas:

Draw five small circles in a row. The five small circles always take one second to complete the animation with transparency ranging from 1 to 0.1. However, the playback time of each animation varies by 0.2 seconds.

See Code implementation:

First draw five small circles:

HTML code

<div class="loader"><span></span><span></span><span></span><span></span><span></span></div>

CSS code

.loader span{display: inline-block;vertical-align: middle;width: 10px;height: 10px;background: black;border-radius: 50px;}

Next, let's customize the animation.

CSS code

.loader span{display: inline-block;vertical-align: middle;width: 10px;height: 10px;background: black;border-radius: 50px;-webkit-animation: loader 1s infinite alternate;-moz-animation: loader 1s infinite alternate;}@-webkit-keyframes loader {0% {opacity: 1;}100% {opacity: 0.1;}}@-moz-keyframes loader {0% {opacity: 1;}100% {opacity: 0.1;}}

Finally, we add the latency animation command:
CSS code

.loader span{display: inline-block;vertical-align: middle;width: 10px;height: 10px;background: black;border-radius: 50px;-webkit-animation: loader 1s infinite alternate;-moz-animation: loader 1s infinite alternate;}.loader span:nth-of-type(2) {-webkit-animation-delay: 0.2s;-moz-animation-delay: 0.2s;}.loader span:nth-of-type(3) {-webkit-animation-delay: 0.4s;-moz-animation-delay: 0.4s;}.loader span:nth-of-type(4) {-webkit-animation-delay: 0.6s;-moz-animation-delay: 0.6s;}.loader span:nth-of-type(5) {-webkit-animation-delay: 0.8s;-moz-animation-delay: 0.8s;}@-webkit-keyframes loader {0% {opacity: 1;}100% {opacity: 0.1;}}@-moz-keyframes loader {0% {opacity: 1;}100% {opacity: 0.1;}}

Finally, complete the production.

If you need to adjust the number and time, you can customize the time according to the principle. However, it is best to ensure the time interval of the gradient. If it is too slow, it will make people feel powerless to load, and if it is too fast, it will make people feel uncomfortable.

 

 

  • Copyright statement: Free Reprint-non commercial-Non derivative-keep the signature | Creative Commons BY-NC-ND 3.0
  • Http://soasmeblog.sinaapp.com/posts/46.html

 

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.