I stumbled upon some circular progress bars and I'm a bit confused about how they are filled. Check out this codepen link: https://codepen.io/anon/pen/aeEEmx
From what I understand, when using gradients with specified positions (degrees in this case), it should start where you specify the value. For example, in the CSS for the progress-20 class, there's a linear gradient with 18 deg followed by another one with 90deg, but I can't wrap my head around how these values work together - 18deg and 90deg or -18deg and 90deg as seen in the one with 30%.
Here is the code snippet:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
background-color: #fff;
font-family: "Lato", "Arial", "san-serif";
color: #555;
font-size: 20px;
font-weight: 300px;
text-rendering: optimizeLegibility;
}
.radialProgressBar {
border-radius: 50%;
-webkit-transform: translate(50%, 50%);
transform: translate(50%, 50%);
width: 100px;
height: 100px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
background: #ddd;
margin: 20px;
}
.radialProgressBar .overlay {
border-radius: 50%;
width: 80px;
height: 80px;
margin: auto;
background: #fff;
text-align: center;
padding-top: 30%;
}
.progress-20 {
background-image: linear-gradient(18deg, #ddd 50%, transparent 50%), linear-gradient(90deg, #028cd5 50%, #ddd 50%);
}
.progress-30 {
background-image: linear-gradient(-18deg, #ddd 50%, transparent 50%), linear-gradient(90deg, #028cd5 50%, #ddd 50%);
}
.progress-40 {
background-image: linear-gradient(-54deg, #ddd 50%, transparent 50%), linear-gradient(90deg, #028cd5 50%, #ddd 50%);
}
.progress-70 {
background-image: linear-gradient(90deg, #028cd5 50%, transparent 50%), linear-gradient(18deg, #028cd5 50%, #ddd 50%);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="radialProgressBar progress-20">
<div class="overlay">20</div>
</div>
<div class="radialProgressBar progress-30">
<div class="overlay">30</div>
</div>
<div class="radialProgressBar progress-40">
<div class="overlay">40</div>
</div>
<div class="radialProgressBar progress-70">
<div class="overlay">70</div>
</div>
</body>
</html>