Created
February 5, 2011 18:26
-
-
Save the55/812657 to your computer and use it in GitHub Desktop.
2 raphael arc objects
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
// http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands | |
Raphael.fn.arc = function(startX, startY, endX, endY, radius1, radius2, angle) { | |
var arcSVG = [radius1, radius2, angle, 0, 1, endX, endY].join(' '); | |
return this.path('M'+startX+' '+startY + " a " + arcSVG); | |
}; | |
Raphael.fn.circularArc = function(centerX, centerY, radius, startAngle, endAngle) { | |
var startX = centerX+radius*Math.cos(startAngle*Math.PI/180); | |
var startY = centerY+radius*Math.sin(startAngle*Math.PI/180); | |
var endX = centerX+radius*Math.cos(endAngle*Math.PI/180); | |
var endY = centerY+radius*Math.sin(endAngle*Math.PI/180); | |
return this.arc(startX, startY, endX-startX, endY-startY, radius, radius, 0); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment