[ Launch: Progres Arc ] e4b8cf76b51bde574f6f by nicohaemhouts
-
-
Save nicohaemhouts/e4b8cf76b51bde574f6f to your computer and use it in GitHub Desktop.
Progres Arc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"Progres Arc","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var height = 750, | |
width = 800, | |
svg = d3.select('svg') | |
.attr('width', width) | |
.attr('height', height) | |
.append("g") | |
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")"), | |
t = 2 * Math.PI; | |
// An arc function with all values bound except the endAngle. So, to compute an | |
// SVG path string for a given angle, we pass an object with an endAngle | |
// property to the `arc` function, and it will return the corresponding string. | |
var arc = d3.svg.arc() | |
.innerRadius(180) | |
.outerRadius(240) | |
.startAngle(0); | |
// Add the background arc, from 0 to 100% (τ). | |
var background = svg.append("path") | |
.datum({endAngle: t}) | |
.style("fill", "#ddd") | |
.attr("d", arc); | |
// Add the foreground arc in orange, currently showing 12.7%. | |
var foreground = svg.append("path") | |
.datum({endAngle: 0.83 * t}) | |
.style("fill", "orange") | |
.attr("d", arc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment