Here's a demo I made for you.
The main function used is to find a point on a circle, as below:
function findPoint(cx, cy, rad, cornerGrad){
var cornerRad = cornerGrad * Math.PI / 180;
var nx = Math.cos(cornerRad)*rad + cx;
var ny = Math.sin(cornerRad)*rad + cy;
return { x: nx, y: ny };
}