Skip to content
Related Articles

Related Articles

Spinning Ball Animation with Glow Effect using CSS

Improve Article
Save Article
Like Article
  • Last Updated : 23 Feb, 2021

Spinning ball animation can be easily created using the transform property to rotate the ball. The animation iteration count is applied as infinite to get the never-ending spinning animation. To get the glowing effect,  box-shadow is used.


  • Create an HTML file with the name index.html.
  • Create a div element in the index.html file and give a class name ball.
  • Add style to this class name.
  • Create an animation named spinball using @keyframes rule. Use transform property to rotate the ball.
  • Apply 2 color inset combination in the box-shadow property to get the glowing spinning effect.
  • Spinning speed can be adjusted by changing the animation duration.


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" 
    <meta name="viewport" content=
        "width=device-width, initial-scale=1.0">
    <title>Spinning Ball Animation</title>
        * {
            background-color: black;
        .ball {
            height: 40px;
            width: 40px;
            border-radius: 100px;
            position: fixed;
            top: 50vh;
            left: 50vw;
            animation: spinBall 0.13s linear infinite;
            box-shadow: inset 0 0 18px #fff, 
                inset 6px 0 18px violet, 
                inset -6px 0 18px #0ff, 
                inset 6px 0 30px violet, 
                inset -6px 0 30px #0ff, 
                0 0 18px #fff, -4px 
                0 18px violet, 4px 0 18px #0ff;
        @keyframes spinBall {
            100% {
                transform: rotate(360deg);
    <div class="ball"></div>


Spinning Ball Animation

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!