Source code:
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Rotating Squares Loader</title>
<style>
body{
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, #4CAF50, #add5f5);
font-family: sans-serif;
overflow: hidden;
}
.loader-container{
position: relative;
width: 100px;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
}
.square{
position: absolute;
width: 20px;
height: 20px;
animation: rotate 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}
.square:nth-child(1){
top: 0;
left: 0;
background: red;
animation-delay: 0s;
}
.square:nth-child(2){
top: 0;
right: 0;
background: yellow;
animation-delay: 0.2s;
}
.square:nth-child(3){
bottom: 0;
right: 0;
background: blue;
animation-delay: 0.4s;
}
.square:nth-child(4){
bottom: 0;
left: 0;
background: green;
animation-delay: 0.6s;
}
@keyframes rotate{
0%, 100%{
transform: scale(1) rotate(0deg);
}
50%{
transform: scale(1.5) rotate(45deg);
}
}
</style>
</head>
<body>
<div class=”loader-container”>
<div class=”square”></div>
<div class=”square”></div>
<div class=”square”></div>
<div class=”square”></div>
</div>
</body>
</html>