Skip to content

Instantly share code, notes, and snippets.

@tomshaw
Created December 28, 2020 17:03
Show Gist options
  • Save tomshaw/f995c43003548255234819517fc93cb1 to your computer and use it in GitHub Desktop.
Save tomshaw/f995c43003548255234819517fc93cb1 to your computer and use it in GitHub Desktop.
Set svg circle circumference stroke.
this.$svgCircle = document.querySelector("circle");
this.circumference = 2 * Math.PI * this.$svgCircle.getAttribute("r");
setCircleProgress(amount) {
let res = amount * this.circumference / 100 + ", " + this.circumference;
this.$svgCircle.setAttribute("stroke-dasharray", res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment