Open In App

How to Design Fade balls loader Animation using CSS ?

Minimal Fading balls loader is a basic CSS animation, where the loader animation will be utilized to engage the user until when a specific page or content is fully get loaded in a particular platform. In this article, we will see how to create a loader animation with three balls animation effect which looks like the balls are fading away with some delay in their fading animation, for an infinite time period. We will also be using the easing out CSS function to smoothen, along with different CSS functions available for the animation.

Syntax: 



@keyframes animation_name {
  keyframes-selector {
   css-styles;
 }
}

Approach: The following approach will be utilized to create the Fading balls loader animation, which is described below:

 



Example: This example illustrates the Fading balls loader animation in CSS.




<!DOCTYPE html>
<html>
  
<head>
    <style>
        body {
            display: grid;
            place-items: center;
        }
          
        .spinner {
            width: 100px;
            height: 100px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
          
        .spinner span {
            width: 20px;
            height: 20px;
            border-radius: 100%;
            background-color: rgb(0, 113, 128);
            opacity: 0;
        }
          
        .spinner span:nth-child(1) {
            animation: fade 1s ease-in-out infinite;
        }
          
        .spinner span:nth-child(2) {
            animation: fade 1s ease-in-out 0.33s infinite;
        }
          
        .spinner span:nth-child(3) {
            animation: fade 1s ease-in-out 0.66s infinite;
        }
          
        @keyframes fade {
          
            0%,
            100% {
                opacity: 1;
            }
          
            60% {
                opacity: 0;
            }
        }
    </style>
</head>
  
<body>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
    <h3 style="color:green">
        Fading balls loader CSS Animation
    </h3>
    <div class="spinner">
        <span></span>
        <span></span>
        <span></span>
    </div>
</body>
  
</html>

Output:

 


Article Tags :