Home > Web Front-end > CSS Tutorial > Tutorial on using CSS loading animation effect

Tutorial on using CSS loading animation effect

php中世界最好的语言
Release: 2018-03-20 17:23:31
Original
1723 people have browsed it

This time I will bring you a tutorial on how to use the CSS loading animation effect. What are the precautions for using the CSS loading animation effect? ​​The following is a practical case, let's take a look.

This article introduces a pure CSS loading effect code example to share with everyone, the details are as follows:

Preview

Code

Using CSS keyframes to customize keyframe animation

<!DOCTYPE html>  
<html lang="en">  
    <head>
        <title>Loading</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <style>
            p#preload {
    margin: auto;
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 9999999
}
p#preload>img {  
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    -webkit-transform: translate(-50%,-50%);
    -moz-transform: translate(-50%,-50%);
    -ms-transform: translate(-50%,-50%);
    -o-transform: translate(-50%,-50%)
}
p#preload .cssload-loader {  
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    width: 62px;
    height: 62px;
    top: 50%;
    margin-top: -31px;
    border-radius: 50%;
    -o-border-radius: 50%;
    -ms-border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    perspective: 780px
}
p#preload .cssload-inner {  
    position: absolute;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    -o-box-sizing: border-box;
    -ms-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    border-radius: 50%;
    -o-border-radius: 50%;
    -ms-border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%
}
p#preload .cssload-inner.cssload-one {  
    left: 0;
    top: 0;
    animation: cssload-rotate-one 1.15s linear infinite;
    -o-animation: cssload-rotate-one 1.15s linear infinite;
    -ms-animation: cssload-rotate-one 1.15s linear infinite;
    -webkit-animation: cssload-rotate-one 1.15s linear infinite;
    -moz-animation: cssload-rotate-one 1.15s linear infinite;
    border-bottom: 3px solid #000
}
p#preload .cssload-inner.cssload-two {  
    right: 0;
    top: 0;
    animation: cssload-rotate-two 1.15s linear infinite;
    -o-animation: cssload-rotate-two 1.15s linear infinite;
    -ms-animation: cssload-rotate-two 1.15s linear infinite;
    -webkit-animation: cssload-rotate-two 1.15s linear infinite;
    -moz-animation: cssload-rotate-two 1.15s linear infinite;
    border-right: 3px solid #000
}
p#preload .cssload-inner.cssload-three {  
    right: 0;
    bottom: 0;
    animation: cssload-rotate-three 1.15s linear infinite;
    -o-animation: cssload-rotate-three 1.15s linear infinite;
    -ms-animation: cssload-rotate-three 1.15s linear infinite;
    -webkit-animation: cssload-rotate-three 1.15s linear infinite;
    -moz-animation: cssload-rotate-three 1.15s linear infinite;
    border-top: 3px solid #000
}
@keyframes cssload-rotate-one {
    0% {
        transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg)
    }
    100% {
        transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg)
    }
}
@-o-keyframes cssload-rotate-one {
    0% {
        -o-transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg)
    }
    100% {
        -o-transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg)
    }
}
@-ms-keyframes cssload-rotate-one {
    0% {
        -ms-transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg)
    }
    100% {
        -ms-transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg)
    }
}
@-webkit-keyframes cssload-rotate-one {
    0% {
        -webkit-transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg)
    }
    100% {
        -webkit-transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg)
    }
}
@-moz-keyframes cssload-rotate-one {
    0% {
        -moz-transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg)
    }
    100% {
        -moz-transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg)
    }
}
@keyframes cssload-rotate-two {
    0% {
        transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg)
    }
    100% {
        transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg)
    }
}
@-o-keyframes cssload-rotate-two {
    0% {
        -o-transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg)
    }
    100% {
        -o-transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg)
    }
}
@-ms-keyframes cssload-rotate-two {
    0% {
        -ms-transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg)
    }
    100% {
        -ms-transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg)
    }
}
@-webkit-keyframes cssload-rotate-two {
    0% {
        -webkit-transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg)
    }
    100% {
        -webkit-transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg)
    }
}
@-moz-keyframes cssload-rotate-two {
    0% {
        -moz-transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg)
    }
    100% {
        -moz-transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg)
    }
}
@keyframes cssload-rotate-three {
    0% {
        transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg)
    }
    100% {
        transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg)
    }
}
@-o-keyframes cssload-rotate-three {
    0% {
        -o-transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg)
    }
    100% {
        -o-transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg)
    }
}
@-ms-keyframes cssload-rotate-three {
    0% {
        -ms-transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg)
    }
    100% {
        -ms-transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg)
    }
}
@-webkit-keyframes cssload-rotate-three {
    0% {
        -webkit-transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg)
    }
    100% {
        -webkit-transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg)
    }
}
@-moz-keyframes cssload-rotate-three {
    0% {
        -moz-transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg)
    }
    100% {
        -moz-transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg)
    }
}
        </style>
    </head>
    <body>
    <p id="preload">
                    <p class="cssload-loader">
                <p class="cssload-inner cssload-one"></p>
                <p class="cssload-inner cssload-two"></p>
                <p class="cssload-inner cssload-three"></p>
            </p>
    </p>
    </body>
</html>
Copy after login
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

How to use the linear-gradient linear gradient of CSS3

Detailed explanation of the mask-image attribute of CSS

The above is the detailed content of Tutorial on using CSS loading animation effect. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template