You can use spans along with the icon fingerprint. Then just work with one keyframes to make the animation by rotating two spans in sequence: the one on the right starts the animation immediately by completing the circle halfway, while the one on the left starts after 1.5 seconds when the right starts, and the two animations last 1.5 seconds, totaling 3 seconds of animation.
The duration time is adjustable, just change the values:
// PRIMEIRA ANIMAÇÃO
.fingerprint:hover .progress-right .progress-bar{
animation: loading 1.5s linear forwards;
↑
duração
}
// SEGUNDA ANIMAÇÃO
.progress:hover .progress-left .progress-bar{
animation: loading 1.5s linear forwards 1.5s;
↑ ↑
duração tempo de atraso
}
If you want to make size adjustments, you do not touch anything except the properties width
and height
of the elements and font-size
of the icon.
See working (mouse over the icon):
.progress *{
box-sizing: border-box;
}
.progress{
width: 130px;
height: 130px;
position: absolute;
top: 0;
left: 0;
}
.progress > span{
width: 50%;
height: 100%;
overflow: hidden;
position: absolute;
top: 0;
}
.progress .progress-bar{
width: 100%;
height: 100%;
border: 5px solid transparent;
position: absolute;
top: 0;
}
.progress .progress-left .progress-bar{
left: 100%;
border-top-right-radius: 80px;
border-bottom-right-radius: 80px;
border-left: 0;
-webkit-transform-origin: center left;
transform-origin: center left;
}
.progress .progress-right .progress-bar{
left: -100%;
border-top-left-radius: 80px;
border-bottom-left-radius: 80px;
border-right: 0;
-webkit-transform-origin: center right;
transform-origin: center right;
}
.progress .progress-right{
right: 0;
}
.progress .progress-bar{
border-color: #8fa09c;
}
@keyframes loading{
0%{
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100%{
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
}
.fingerprint .fas{
font-size: 100px;
padding: 15px;
color: #9e9e9e;
}
.fingerprint{
display: inline-block;
width: 130px;
height: 130px;
position: relative;
margin: 10px;
}
.fingerprint:hover .progress-right .progress-bar{
animation: loading 1.5s linear forwards;
}
.progress:hover .progress-left .progress-bar{
animation: loading 1.5s linear forwards 1.5s;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<div class="fingerprint">
<i class="fas fa-fingerprint"></i>
<div class="progress">
<span class="progress-left">
<span class="progress-bar"></span>
</span>
<span class="progress-right">
<span class="progress-bar"></span>
</span>
</div>
</div>
Show also the HTML of the element.
– Sam