I am unable to get the circle bar to animate. I attempted adding transition: all 600ms ease;
but that didn't work. I am not sure if CSS animation supports conic-gradient
.
jQuery(function ($) {
$('.bar').addClass('animate');
});
.icon {
width: 146px;
height: 146px;
padding: 36px;
position: relative;
flex-shrink: 0;
}
.icon .bar {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
}
.icon .bar::before {
content: "";
position: absolute;
border-radius: 50%;
inset: 0;
background: conic-gradient(#00a451 0%, #e1e1e1 0%);
z-index: 1;
transition: all 600ms ease;
}
.icon .bar::after {
content: "";
background-color: #fff;
border-radius: 50%;
width: 110px;
height: 110px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
}
.icon .bar.animate::before {
background: conic-gradient(#00a451 var(--stat-bar), #e1e1e1 0%);
}
<div class="icon">
<div class="bar" style="--stat-bar:75%"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
@property
first - stackoverflow.com/a/74079080/1427878