Snake-Like Moving Glow around an element

Dan Benjamin

I am wondering how can you build a "snake like" effect around the rim of an object using javascript/css.

This effect will create an ever going animation around an object that looks like a tiny white slug moving on the rim of the object (looking like a glow)

(Will Edit this Question once I learn the correct phrasing)

Starx

I have a small CSS3 version of this:

A small container and an our snake:

<div id="cont"></div>
<div class="snake"></div>

And here is the CSS Magic:

#cont {
    width: 150px;
    height: 150px;
    background: #000;
    margin: 10px;
}
.snake {
    width: 5px;
    height: 5px;        
    background: #f00;
    position: absolute;
    top: 5px;
    left: 15px;
    animation: around 5s infinite;
}
@keyframes around
{
    0% { left: 15px; top: 5px; }
    25% { left: 165px; top: 5px;  }
    50% { top:  160px; left: 165px; }
    75% { left: 15px; top: 160px; }
    100% { top: 5px; left: 15px; }
}

[Demo]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related