<div class="circle"></div>

<!--

The red ball CSS has been taken from pen by Iván Suro (https://codepen.io/isuro/)

https://codepen.io/isuro/pen/LyCIo

-->
.circle {
  display: block;
  width: 100px;
  height: 100px;
  background: red;
  border-radius: 50%;
  background: -webkit-radial-gradient(25px 25px, circle, red, #000);
  background: -moz-radial-gradient(25px 25px, circle, red, #000);
  background: radial-gradient(25px 25px, circle, red, #000);
 
  /* Animation to spin and move the sphere */
  -webkit-animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
  -moz-animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
  -ms-animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
  animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
  
  -webkit-transition: all 1s ease;
  transition: all 1s ease;
  
  position: absolute;
  left: 0;
}

/* Spinning the sphere using key frames */
@-ms-keyframes spin {
  from { -ms-transform: rotate(0deg); }
  to { -ms-transform: rotate(360deg); }
}
@-moz-keyframes spin {
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@-webkit-keyframes spin {
  from { -webkit-transform: rotate(0deg); }
  to { -webkit-transform: rotate(360deg); }
}

/* Move sphere from left to right */
@-moz-keyframes moveLeftToRight {
  0%   { left: -100px; }
  100% { left: 100%; }
}
@-ms-keyframes moveLeftToRight {
  0%   { left: -100px; }
  100% { left: 100%; }
}
@keyframes moveLeftToRight {
  0%   { left: -100px; }
  100% { left: 100%; }
}
@-webkit-keyframes moveLeftToRight {
  0%   { left: -100px; }
  100% { left: 100%; }
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.