Skip to content

Instantly share code, notes, and snippets.

@eldilibra
Created February 3, 2015 05:05
Show Gist options
  • Save eldilibra/dacd7918be0775c84b35 to your computer and use it in GitHub Desktop.
Save eldilibra/dacd7918be0775c84b35 to your computer and use it in GitHub Desktop.
for (var i = 24; i > 0; i--) {
var fillColor = i % 2 == 0 ? 'blue' : 'orange';
var largeArcFlag = i < 13 ? 0 : 1;
var angle = i + 1 * 15;
var x = Math.cos(toRadians(angle)) * 150 - 150;
var y = 0 - (Math.sin(toRadians(angle)) * 150);
var svgPath = '<path data-index="%s" d="M 200,200 l 150,0 a150,150 0 %s,0 %s,%s z" fill="%s" stroke="black" stroke-width="2" stroke-linejoin="round" />'
console.log(svgPath, i, largeArcFlag, x, y, fillColor);
}
function toRadians (angle) {
return angle * (Math.PI / 180);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment