Skip to content

Instantly share code, notes, and snippets.

@eldilibra
Created February 3, 2015 05:10
Show Gist options
  • Save eldilibra/23a980c6a027e14fae47 to your computer and use it in GitHub Desktop.
Save eldilibra/23a980c6a027e14fae47 to your computer and use it in GitHub Desktop.
for (var i = 24; i > -1; i--) {
var fillColor = i % 2 == 0 ? 'blue' : 'orange';
var largeArcFlag = i < 13 ? 0 : 1;
var angle = i * 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="0.3" 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