I've been working on creating a round progress bar that features an arrow at the front.
This is my current progress:
HTML Code:
<!-- Container -->
<ul class="progress">
<!-- Item -->
<li data-name="Item 1" data-percent="Item 1">
<svg viewBox="-10 -10 220 220">
<g fill="none" stroke-width="2" transform="translate(100,100)">
<path d="M 0,-100 A 100,100 0 0,1 86.6,-50" stroke="url(#cl1)"/>
<path d="M 86.6,-50 A 100,100 0 0,1 86.6,50" stroke="url(#cl2)"/>
<path d="M 86.6,50 A 100,100 0 0,1 0,100" stroke="url(#cl3)"/>
<path d="M 0,100 A 100,100 0 0,1 -86.6,50" stroke="url(#cl4)"/>
<path d="M -86.6,50 A 100,100 0 0,1 -86.6,-50" stroke="url(#cl5)"/>
<path d="M -86.6,-50 A 100,100 0 0,1 0,-100" stroke="url(#cl6)"/>
</g>
</svg>
<svg viewBox="-10 -10 220 220">
<path d="M200,100 C200,44.771525 155.228475,0 100,0 C44.771525,0 0,44.771525 0,100 C0,155.228475 44.771525,200 100,200 C155.228475" stroke-dashoffset="590"></path>
</svg>
</li>
</ul>
<!-- Defining Angle Gradient Colors -->
<svg width="0" height="0">
<defs>
<linearGradient id="cl1" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="1">
<stop stop-color="#18FFA9"/>
<stop offset="100%" stop-color="#18FFA9"/>
</linearGradient>
<linearGradient id="cl2" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="0" y2="1">
<stop stop-color="#18FFA9"/>
<stop offset="100%" stop-color="#4FC0EB"/>
</linearGradient>
<linearGradient id="cl3" gradientUnits="objectBoundingBox" x1="1" y1="0" x2="0" y2="1">
<stop stop-color="#4FC0EB"/>
<stop offset="100%" stop-color="#FD8AE6"/>
</linearGradient>
[currently pasted only part of svg colors gradient]
</defs>
</svg>
CSS Styles:
html,
body {
background-color: black;
color: white;
}
@keyframes load {
0% {
stroke-dashoffset: 0;
}
}
.progress {
position: relative;
display: inline-block;
padding: 0;
text-align: center;
}
.progress > li {
display: inline-block;
position: relative;
text-align: center;
font-size: 28px;
line-height: 34px;
}
.progress > li:after {
content: attr(data-percent);
position: absolute;
top: 40%;
left: 20%;
font-size: 28px;
text-align: center;
margin: auto;
width: 193px;
vertical-align: middle;
display: block;
text-transform: uppercase;
}
.progress svg {
width: 409px;
height: 409px;
}
.progress svg:nth-child(2) {
position: absolute;
left: 0;
top: 0;
transform: rotate(-90deg);
}
.progress svg:nth-child(2) path {
fill: none;
stroke-width: 25;
stroke-dasharray: 629;
stroke: black;
opacity: 0.9;
animation: load 1s;
}
https://jsfiddle.net/qr7cs40t/1
I came across this code and made some style edits to it.
I'm finding it challenging to work with SVG as I lack experience in it. I tried following tutorials to add the arrow using SVG but faced difficulties.
Currently, there are two main challenges:
- To incorporate an arrow at the front of the progress circular wheel so that it moves along with the progress.
- To change the direction from clockwise to also counterclockwise. I aim to have two clockwise and one counterclockwise progress bars on my page.
The arrow should resemble this icon: https://fontawesome.com/icons/arrow-from-bottom?style=light, matching the width of the circular progress bar.
Here's a visual example of the desired outcome:
https://i.sstatic.net/qkdbu.png