<div class="progress">
<svg class="pie" width="32" height="32">
<circle r="8" cx="16" cy="16" />
</svg>
<svg class="tick" viewBox="0 0 24 24">
<polyline points="18,7 11,16 6,12" />
</svg>
</div>
<input type="range" min="0" max="100" value="20" step="1" name="percent">
<!-- dribbble -->
<a class="dribbble" href="https://dribbble.com/shots/6701516-Progress-checkmark" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
:root {
--primary: #5628EE;
--success: #3FDC75;
--light: #CDD9ED;
}
.progress {
--background: #fff;
border-radius: 50%;
background: var(--light);
position: relative;
&:before {
--s: 1;
content: '';
width: 28px;
height: 28px;
left: 50%;
top: 50%;
z-index: 1;
position: absolute;
background: var(--background);
border-radius: inherit;
transform: translate(-50%, -50%) scale(var(--s));
transition: transform .32s ease;
}
svg {
display: block;
fill: none;
&.pie {
--s: 1;
width: 32px;
height: 32px;
transform: rotate(-90deg) scale(var(--s));
transition: transform .5s ease;
circle {
stroke-width: 16;
stroke: var(--primary);
}
}
&.tick {
--path: 17.805;
width: 24px;
height: 24px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
stroke-width: 3;
stroke-linecap: round;
stroke-linejoin: round;
stroke: var(--primary);
transition: stroke .3s ease .8s;
polyline {
stroke-dasharray: 18 18 18;
stroke-dashoffset: 18;
transition: stroke-dashoffset .4s ease .7s;
}
}
}
&.complete {
background: none;
&:before {
--s: 0;
}
svg {
&.pie {
--s: .08;
animation: tick .3s linear forwards .4s;
}
&.tick {
stroke: var(--success);
polyline {
stroke-dashoffset: 36;
}
}
}
}
}
@keyframes tick {
100% {
transform: rotate(-90deg) translate(0, -6px) scale(var(--s));
}
}
.rangeSlider {
--active: var(--primary);
--border: var(--light);
--handle: var(--primary);
--background: #fff;
position: absolute;
background: none;
border: 1px solid var(--border);
border-radius: 6px;
cursor: pointer;
left: 50%;
bottom: 80px;
transform: translateX(-50%);
&.rangeSlider__horizontal {
height: 10px;
width: 160px;
}
.rangeSlider__fill {
border-radius: 7px;
background: var(--active);
position: absolute;
&:before {
content: '';
left: -2px;
top: -2px;
bottom: -2px;
right: -2px;
border: 2px solid var(--background);
border-radius: 6px;
position: absolute;
}
}
.rangeSlider__fill__horizontal {
height: 100%;
top: 0;
left: 0;
}
.rangeSlider__handle {
border: 2px solid var(--background);
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
display: inline-block;
width: 22px;
height: 22px;
position: absolute;
background: var(--handle);
border-radius: 50%;
}
.rangeSlider__handle__horizontal {
top: -7px;
}
}
.progress {
&.complete {
& + input {
& + .rangeSlider {
opacity: 0;
transition: opacity .4s ease;
}
}
}
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
* {
box-sizing: inherit;
&:before,
&:after {
box-sizing: inherit;
}
}
// Center & dribbble
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #fff;
.dribbble {
position: fixed;
display: block;
right: 20px;
bottom: 20px;
img {
display: block;
height: 28px;
}
}
}
View Compiled
$(document).ready(function() {
let progress = $('.progress'),
pie = progress.children('.pie'),
slider = $('input[name="percent"]');
slider.on('change input', e => {
setPercent(pie, slider.val());
}).trigger('change');
function setPercent(pie, value) {
let total = 2 * Math.PI * 8;
if(!progress.hasClass('complete')) {
pie.css('strokeDasharray', (value * total / 100) + ' ' + total);
if(value == 100) {
progress.addClass('complete');
}
}
}
});
for(let i = 0, element; element = document.querySelectorAll('input[type="range"]')[i++];) {
rangeSlider.create(element, {
polyfill: true
});
}
This Pen doesn't use any external CSS resources.