This is the 222nd day of my participation in the August Text Challenge.More challenges in August

Author: battleKing warehouse: Github, CodePen blog: CSDN, nuggets feedback email: [email protected] Special statement: original is not easy, shall not be reproduced without authorization or plagiarism, if need to be reproduced can contact the author authorized

background

A good app, tool, or website should be well-made and responsive to users’ needs. When I was releasing the first version of a product, the loading of login verification… The delay was 2-3 seconds. As a result, the feedback mailbox was crowded by users on the same day. Most users thought that the interface suddenly froze and it was a software BUG, but in fact it was just us verifying login information. This is a very bad user experience, and while early adopters may give your product a second chance, the vast majority of them lose information about the product and don’t use it anymore, leading to a mass exodus of users.

Solution: Use load animations to provide even feedback and reduce user anxiety

Loading animation classification: progress bar loading animation, infinite loop loading animation and skeleton diagram loading animation

Excellent loading animation features

  1. The core isReduce animation time
  2. givenThe specific time
  3. Tell the userWhy wait
  4. Make the waiting process less boringUse fun animations
  5. Reduce the user’s psychological perception of waiting timecolor,Some relevant knowledge,A product operation instruction
  6. Transparent communication of company brand imageCorporate philosophy,Company values,The company's mascot

The final result

Add HTML files

  1. Add a class name for the outermost layerlds-spinnerdiv
  2. Let’s add a couple of themdiv
    <div class="lds-spinner">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
Copy the code

2. Add the CSS file

  1. Set up the*box-sizing: border-box
  2. Set up thebodyKeep the whole project centered
* {
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    background: #eaac83;
}
Copy the code

The main CSS code

.lds-spinner {
    color: official;
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-spinner div {
    transform-origin: 40px 40px;
    animation: lds-spinner 1.2 s linear infinite;
}

.lds-spinner div:after {
    content: "";
    display: block;
    position: absolute;
    top: 3px;
    left: 37px;
    width: 6px;
    height: 18px;
    border-radius: 20%;
    background: #fff;
}

.lds-spinner div:nth-child(1) {
    transform: rotate(0deg);
    animation-delay: -1.1 s;
}

.lds-spinner div:nth-child(2) {
    transform: rotate(30deg);
    animation-delay: -1s;
}

.lds-spinner div:nth-child(3) {
    transform: rotate(60deg);
    animation-delay: -0.9 s;
}

.lds-spinner div:nth-child(4) {
    transform: rotate(90deg);
    animation-delay: -0.8 s;
}

.lds-spinner div:nth-child(5) {
    transform: rotate(120deg);
    animation-delay: -0.7 s;
}

.lds-spinner div:nth-child(6) {
    transform: rotate(150deg);
    animation-delay: -0.6 s;
}

.lds-spinner div:nth-child(7) {
    transform: rotate(180deg);
    animation-delay: -0.5 s;
}

.lds-spinner div:nth-child(8) {
    transform: rotate(210deg);
    animation-delay: -0.4 s;
}

.lds-spinner div:nth-child(9) {
    transform: rotate(240deg);
    animation-delay: -0.3 s;
}

.lds-spinner div:nth-child(10) {
    transform: rotate(270deg);
    animation-delay: -0.2 s;
}

.lds-spinner div:nth-child(11) {
    transform: rotate(300deg);
    animation-delay: -0.1 s;
}

.lds-spinner div:nth-child(12) {
    transform: rotate(330deg);
    animation-delay: 0s;
}

@keyframes lds-spinner {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0; }}Copy the code

❤️ thank you

If this article is helpful to you, please support it by clicking a “like”. Your “like” is my motivation for writing.

If you like this article, you can “like” + “favorites” + “forward” to more friends.