Skip to main content
<CodeWithBhurtel/>
HomeLearnProjectsChallengesBlogAboutContactLogin
<CodeWithBhurtel/>

Learn through structured lessons, real projects, and live challenges. Free tutorials for HTML, CSS, JavaScript, and more.

Pages

  • Home
  • Learn
  • Blog
  • Projects
  • Challenges
  • About
  • Contact

Lessons

  • HTML
  • CSS
  • JavaScript

© 2026 CodeWithBhurtel. All rights reserved.

Privacy PolicyTerms & Conditions
Projects

Loading Animation

IntermediateHTML, CSS

The liquid merging effect is not real physics. It is just a blur filter that cranks up the contrast so high that overlapping edges snap together and look like one shape.

Loading Animation – project preview
Share this project
Follow me on social media

About this project

This project builds a loading screen animation entirely without JavaScript. That is the first thing worth noting. Every movement you see happens through CSS keyframes and SVG filters working together. The eight white circles are plain HTML span elements. They have no class names beyond what the parent container gives them and no JavaScript touching them at runtime.

The circular movement works because each span has its transform-origin set to 150px. The .drops container is 300px wide. Setting the origin to 150px places the pivot point at the exact center of that container. When the animation rotates a span, it swings around that center point like a hand on a clock. Because all eight spans share the same center and the same rotation range, they all trace the same invisible circle.

What makes it look liquid instead of mechanical is the SVG filter named Gooey. The filter runs two operations in sequence. First feGaussianBlur blurs everything inside the .drops container. Second feColorMatrix cranks the contrast of the alpha channel to an extreme value. When two blurred shapes get close enough to each other their blurred edges overlap. The contrast boost then snaps that overlapping blur back to fully opaque. The result looks like the two drops are physically merging into a single blob. When they move apart the merged blob pinches and splits. That pinching and splitting is the liquid effect. It is not a real physics simulation. It is a visual trick done entirely with math applied to pixels.

The loading text sits on a separate layer above the drops container. It fades in and out on its own independent loop using a different keyframe animation. The timing is set to match the overall rhythm of the drops so the whole composition feels coordinated even though the text and drops are animated separately.

What you will learn

You will learn that CSS custom properties are not just for storing colors or font sizes. This project uses --i as an index variable set directly in the HTML. CSS then reads that index inside a calc() expression to compute a unique animation delay for each span. That pattern is reusable in dozens of other situations where you need to stagger repeated elements without writing unique styles for each one.

You will understand how transform-origin actually works. Most people set it and move on without thinking about why. This project forces you to understand it because the entire circular motion depends on getting that value exactly right. Change it by even a small amount and the circle becomes lopsided.

You will learn how SVG filters can be applied to HTML elements. The filter is defined inside an SVG block in the HTML but it is consumed by a CSS filter: url() rule on a regular div. That cross-technology connection is something many developers never encounter and it opens up a wide range of visual effects that are impossible with CSS alone.

You will also understand the difference between animating a property and animating a transform. The drops do not move by changing their left or top values. They move by rotating around a pivot point. That distinction matters because transform-based animations are handled by the GPU in most browsers. They stay smooth even on lower-end devices because the browser does not have to recalculate layout on every frame.

You will get comfortable reading and writing @keyframes that do more than one thing at once. The animateDrops animation changes rotation and scale at the same time. Understanding how to sequence those changes across percentage keyframes is a skill that applies to almost every CSS animation project you will work on after this.

Understand with AI

Get an AI-generated overview or a file-by-file code breakdown. Ask questions about the project below the overview.

AI Overview: Liquid Loader Animation

This project creates a dynamic "Liquid Loader" animation, a common visual element used to indicate that content is loading on a webpage. It features a "Loading..." text that gracefully fades in and out, complemented by eight white circular "drops." These drops move in a circular pattern, appearing to merge and separate from each other, giving the animation a distinctive liquid-like or "gooey" effect. The entire animation is presented against a vibrant blue gradient background, providing a modern and engaging user experience.

The core structure is defined in the HTML, starting with a div.container that sets up the full-screen background. Inside, a div.loader holds the h2 element for the "Loading..." text and a div.drops container. The div.drops then contains eight individual span elements, each representing one of the animated liquid drops. A crucial part of the "liquid" effect is an SVG element that defines a filter named "Gooey." This filter uses feGaussianBlur to blur elements and feColorMatrix to increase contrast, making nearby blurred shapes appear to blend together seamlessly.

<div class="drops">
  <span style="--i:0;"></span>
  <span style="--i:1;"></span>
  <!-- ... more spans ... -->
</div>
<svg>
  <filter id="Gooey">
    <feGaussianBlur in="SourceGraphic" stdDeviation="10"></feGaussianBlur>
    <feColorMatrix values="
                           1 0 0 0 0
                           0 1 0 0 0
                           0 0 1 0 0
                           0 0 0 20 -1"></feColorMatrix>
  </filter>
</svg>

This HTML snippet shows the drops container with its individual span elements, each assigned a custom CSS variable --i, and the SVG filter definition that enables the liquid effect.

The styling and animation logic are handled entirely by CSS. The .container is styled with a full-screen gradient, and the .loader is centered. The "Loading..." text (h2) is absolutely positioned and animated to fade in and out using the @keyframes animateText. The div.drops container applies the filter: url(#Gooey) to its contents, which is what makes the span elements appear to merge and separate.

.loader .drops {
  /* ... other styles ... */
  filter: url(#Gooey);
}

This CSS rule applies the "Gooey" SVG filter to the container holding the animated drops, making them appear to merge.

Each span drop is styled as a white circle. Their movement is controlled by the animateDrops keyframe animation, which makes the drops rotate around a central point, change size, and then return to their original state. The transform-origin property is set to the center of the drops container, ensuring a circular rotation. A key technique for creating the flowing sequence is animation-delay: calc(0.15s * var(--i));, which uses the --i custom property from the HTML to stagger the start time of each drop's animation, resulting in a smooth, ripple-like effect.

.loader .drops span {
  position: absolute;
  left: 0;
  transform-origin: 150px; /* Center of the 300px wide .drops container */
  animation: animateDrops 5s ease-in-out infinite;
  animation-delay: calc(0.15s * var(--i));
}

This CSS snippet shows how each span is positioned and how its animation delay is calculated using the --i custom property, creating a staggered effect.

Ask about this project

Have a question about how this project works? Ask below and get an answer based on the project code.

Code Breakdown

Structured technical breakdown for beginners. Anyone can generate or regenerate; your version is saved in this browser (local storage).

No breakdown yet. Generate one to see a file-by-file explanation. Your version is saved in this browser.

Comments

No comments yet. Sign in to leave a comment.

Sign in to leave a comment.