Skip to content
Advertisements

CSS Animation

HTML CODE:

<!DOCTYPE html>
<html>
<head>
    <title>page</title>
     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="animation23.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
</head>
<body>
    
    <div class="loader">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
    </div>

</body>
</html>

CSS CODE:

body{
    padding: 0;
    margin: 0;
    background: #000;
}
.loader{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 305px;
    height: 305px;
}
.loader span{
    position: absolute;
    background: rgba(255,255,255,.1);
    box-shadow: 0 0 25px rgba(0,0,0,.5);
    border: 10px solid rgba(255,255,255,.2);
    border-top: 10px solid rgba(255,255,255,.1);
    border-bottom: 10px solid rgba(255,255,255,.1);
    animation: ani 10s alternate infinite;
}
.loader span:nth-child(1){
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    animation-delay: -0.1s;
}
.loader span:nth-child(2){
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    animation-delay: -0.2s;
}
.loader span:nth-child(3){
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    animation-delay: -0.3s;
}
.loader span:nth-child(4){
    top: 60px;
    left: 60px;
    right: 60px;
    bottom: 60px;
    animation-delay: -0.4s;
}
.loader span:nth-child(5){
    top: 80px;
    left: 80px;
    right: 80px;
    bottom: 80px;
    animation-delay: -0.5s;
}
.loader span:nth-child(6){
    top: 100px;
    left:100px;
    right: 100px;
    bottom: 100px;
    animation-delay: -0.6s;
}
.loader span:nth-child(7){
    top: 120px;
    left: 120px;
    right: 120px;
    bottom: 120px;
    animation-delay: -0.7s;
}
.loader span:nth-child(8){
    top: 140px;
    left: 140px;
    right: 140px;
    bottom: 140px;
    animation-delay: -0.8s;
}
@keyframes ani{
    0%{
        transform: rotate(0deg);
        background: rgb(255,0,0,.2);
    }
    20%{
        background: rgb(255,255,0,.2);
    }
    40%{
        background: rgb(0,255,0,.2);
    }
    60%{
        background: rgb(255,0,255,.2);
    }
    80%{
        background: rgb(0,255,255,.2);
    }
    100%{
        transform: rotate(720deg);
        background: rgb(255,0,0,.2);
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: