.spinner5 { position: fixed; width: 50px; height: 50px; top: calc(50% - 50px/2); left: calc(50% - 50px/2); .cube1, .cube2 { background-color: #fff; width: 15px; height: 15px; position: absolute; top: 0; left: 0; animation: cubemove 1.8s infinite ease-in-out; } .cube2 { animation-delay: -0.9s; } } @keyframes cubemove { 25% { transform: translateX(42px) rotate(-90deg) scale(0.5); } 50% { transform: translateX(42px) translateY(42px) rotate(-179deg); } 50.1% { transform: translateX(42px) translateY(42px) rotate(-180deg); } 75% { transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); } 100% { transform: rotate(-360deg); } }