javascript - Arc progress bar -


i need make circular progress bar (image below), loading start left bottom side right bottom side. light-blue (#e8f6fd) color empty state , strong-blue (#1cadeb) progress.

arc progress bar

i have tried approaches, cannot find best 1 implementation:

  1. first of tried using div element border-radius: 50%; , border-bottom-color: transparent;, jsfiddle. in approach got shape in image problem how can fill border progress?
  2. the second try using canvas, , approach nice expect reason loader appears on screen after js loaded, prevent behavior , show loader when page loaded, jsfiddle

so question there approaches can achive an arc loader or suggestion listed problems.

you can use inline svg arc commands make arc shape. animation can handled css transitioning stroke-dasharray property.

here example, hover arc launch loading animation :

svg {    display: block;    width: 40%;    margin: 0 auto;  }  .loader {    stroke-dasharray: 0 18 18;    transition: stroke-dasharray 2s linear;  }  svg:hover .loader {    stroke-dasharray: 18 0 18;  }
<svg viewbox="0 0.5 10 8">    <path d="m2 8 4 4 0 1 1 8 8" fill="none" stroke-width="0.78" stroke="#e8f6fd" />    <path class="loader" d="m2 8 4 4 0 1 1 8 8" fill="none" stroke-width="0.8" stroke="#00acee" />  </svg>

note need add vendor prefixes transition property browser support (more info on caniuse).


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -