Skip to content
Advertisements

CSS Animation – Block


HTML CODE:

<!DOCTYPE html>
<html>
<head>
    <title>menu</title>
    <link rel="stylesheet" type="text/css" href="animation2.css">
</head>
<body>

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

</body>
</html>

CSS CODE

body{
    margin: 0;
    padding: 0;
    background:#262626;
}
.loader{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) rotate(45deg);
    width: 100px;
    height: 100px;
    animation: ani 1s linear infinite
}
.loader span{
    position: absolute;
    width: 50px;
    height: 50px;
    background: #f00;
    animation: rotade 1s linear infinite
}
.loader span:nth-child(1){
    top: 0;
    left: 0;
    background: #f79f1f;    
}
.loader span:nth-child(2){
    top: 0;
    right: 0;
    background: #12cbc4;    
}
.loader span:nth-child(3){
    bottom: 0;
    right: 0;
    background: #ed4c67;    
}
.loader span:nth-child(4){
    bottom: 0;
    left: 0;
    background: #a3cb38;    
}
@keyframes ani{
    0%{
        width: 100px;
        height: 100px;
    }
    10%{
        width: 100px;
        height: 100px;
    }
    50%{
        width: 150px;
        height: 150px;
    }
    90%{
        width: 100px;
        height: 100px;
    }
    100%{
        width: 100px;
        height: 100px;
    }
}
@keyframes rotade{
    0%{
        transform: rotate(0deg);
    }
    10%{
        transform: rotate(0deg);
    }
    50%{
        transform: rotate(90deg);
    }
    90%{
        transform: rotate(90deg);
    }
    100%{
        transform: rotate(90deg);
    }
}
}
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: