30 Loaders Design with Source Code
1. Water-ripple effect loader
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Loader 1 - Ripple Waves</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #0f172a;
}
.loader {
position: relative;
width: 80px;
height: 80px;
}
.circle {
position: absolute;
top: 50%;
left: 50%;
width: 80px;
height: 80px;
margin: -40px;
border: 3px solid #38bdf8;
border-radius: 50%;
animation: ripple 2s infinite;
opacity: 0;
}
.circle:nth-child(2) {
animation-delay: 0.6s;
}
.circle:nth-child(3) {
animation-delay: 1.2s;
}
@keyframes ripple {
0% {
transform: scale(0.3);
opacity: 1;
}
100% {
transform: scale(2.5);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="loader">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
</body>
</html>
2. Spinning Cube Loader
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loader 2 - Spinning Cube with Edges</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #ffffff; /* White background */
margin: 0;
}
.cube {
width: 80px;
height: 80px;
position: relative;
transform-style: preserve-3d;
animation: spin 3s linear infinite;
}
.face {
position: absolute;
width: 80px;
height: 80px;
background: rgba(0, 0, 0, 0.1); /* Transparent fill so edges show */
border: 2px solid #000000; /* Black edges */
}
/* Position each face of the cube */
.front { transform: rotateY( 0deg) translateZ(40px); }
.back { transform: rotateY(180deg) translateZ(40px); }
.right { transform: rotateY( 90deg) translateZ(40px); }
.left { transform: rotateY(-90deg) translateZ(40px); }
.top { transform: rotateX( 90deg) translateZ(40px); }
.bottom { transform: rotateX(-90deg) translateZ(40px); }
/* Animation */
@keyframes spin {
from { transform: rotateX(0deg) rotateY(0deg); }
to { transform: rotateX(360deg) rotateY(360deg); }
}
</style>
</head>
<body>
<div class="cube">
<div class="face front"></div>
<div class="face back"></div>
<div class="face right"></div>
<div class="face left"></div>
<div class="face top"></div>
<div class="face bottom"></div>
</div>
</body>
</html>
No comments:
Post a Comment