This content originally appeared on DEV Community and was authored by Jatin Sharma
In this article we are gonna build a loading spinner with the glassmorphism, stay tuned for that first let's look what are we building -
We just need simple div
to create this animation. For this animation we have used pseudo classes and a normal keyframe in which we just translate
the ::before
and ::after
HTML
<div class="loader"></div>
CSS
/* Main Loader */
.loader {
position: relative;
width: 180px;
height: 180px;
}
.loader::before,
.loader::after {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
}
/* Loader Blue Circle */
.loader::before {
background: #5989ff;
animation: animate 2s ease-in-out infinite;
}
/* Loader Glassmorphism */
.loader::after {
background: rgba(56, 109, 241, 0.05);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
animation: animate 2s ease-in-out infinite;
z-index: 1;
animation-delay: -1s;
}
/* Animation */
@keyframes animate {
0%,
100% {
transform: translateX(-80px);
}
50% {
transform: translateX(80px);
}
}
Conclusion
So after that, you can use it anywhere in your project. And let me know what do you think about it. If you like it then consider a follow, because I am gonna build more things like this.
- 10 CSS Resources that you should bookmark
- Some Strange Concept of JavaScript
- Some Javascript Methods you should know
This content originally appeared on DEV Community and was authored by Jatin Sharma
Jatin Sharma | Sciencx (2021-10-27T06:16:15+00:00) Glassmorphism Loading Animation. Retrieved from https://www.scien.cx/2021/10/27/glassmorphism-loading-animation/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.