How to Make a Page Loading Animation Using CSS || Horizontal spinner effect using CSS - Creation Code
Page Loader Using CSS:
In this post, we will create a spinner loading effect using CSS. A loader can create an excellent user experience in your app or website. This loader animation will be a horizontal effect and you can use it before loading your page.
Explanation:
1. First, create an HTML file and make a span section with class loader
<span class="loader"></span>
2. Now give the loader class a suitable height and width with some adjustment
.loader{
margin: 600px;
width: 100px;
height: 100px;
position: relative;
}
3. Create the before and after effect
.loader::before,
.loader::after{
content: '';
position: absolute;
width: inherit;
height: inherit;
border-radius: 50%;
mix-blend-mode: multiply;
animation: rotate 1s infinite
cubic-bezier(0.77, 0, 0.175, 1);
}
4. Give it your favourite colour
.loader::before{
background-color: #fc3f9e;
}
.loader::after{
background-color: #50e8f3;
animation-delay: .5s;
}
5. Now create the horizontal moving effect
@keyframes rotate{
0%,100%{
left: 95px;
}
25%{
transform: scale(.3);
}
50%{
left: 0;
}
75%{
transform: scale(1);
}
}
Now combine them
.loader{
margin: 600px;
width: 100px;
height: 100px;
position: relative;
}
.loader::before,
.loader::after{
content: '';
position: absolute;
width: inherit;
height: inherit;
border-radius: 50%;
mix-blend-mode: multiply;
animation: rotate 1s infinite
cubic-bezier(0.77, 0, 0.175, 1);
}
.loader::before{
background-color: #fc3f9e;
}
.loader::after{
background-color: #50e8f3;
animation-delay: .5s;
}
@keyframes rotate{
0%,100%{
left: 95px;
}
25%{
transform: scale(.3);
}
50%{
left: 0;
}
75%{
transform: scale(1);
}
}
Comments
Post a Comment