*edited 4/9 - migrated features from later comments into function posted here
class level globals needed:
var deg2rad = Math.PI/180;
var CLOCKWISE = -1;
var COUNTERCLOCKWISE = 1;
the method:
//dc = drawingcontext from the onUpdate(dc)
//x,y = centerpoint of circle from which to make the arc
//radius = how big
//thickness = how thick of an arc to draw
//angle = 0 (nothing) to 360 (Full circle) in degrees. If you have/use radians, you can swap to radians and remove the deg2rad conversion factor inside, but I'm a degree kind of guy :)
//offsetIn = -180 to 180 in degrees. 0 will start arc from top of screen. Depends on chosen drawing direction, -90 & CLOCKWISE starts arc at 9o'clock, 90 & CLOCKWISE starts at 3o'clock position, 180 and either direction starts from 6o'clock
//colors = array containing [arc color, background fill color(usually black), [border color]] -border color is optional, leave out for no border
//direction = either CLOCKWISE or COUNTERCLOCKWISE and determines which direction the arc will grow in
function drawArc(dc, x, y, radius, thickness, angle, offsetIn, colors, direction){
var color = colors[0];
var bg = colors[1];
var curAngle;
if(angle > 0){
dc.setColor(color,color);
dc.fillCircle(x,y,radius);
dc.setColor(bg,bg);
dc.fillCircle(x,y,radius-thickness);
if(angle < 360){
var pts = new [33];
pts[0] = [x,y];
angle = 360-angle;
var radiusClip = radius + 2;
var offset = 90*direction+offsetIn;
for(var i=1,dec=angle/30f; i <= 31; angle-=dec){
curAngle = direction*(angle-offset)*deg2rad;
pts= [x+radiusClip*Math.cos(curAngle), y+radiusClip*Math.sin(curAngle)];
i++;
}
pts[32] = [x,y];
dc.setColor(bg,bg);
dc.fillPolygon(pts);
}
}else{
dc.setColor(bg,bg);
dc.fillCircle(x,y,radius);
}
if(colors.size() == 3){
var border = colors[2];
dc.setColor(border, Gfx.COLOR_TRANSPARENT);
dc.drawCircle(x, y, radius);
dc.drawCircle(x, y, radius-thickness);
}
}
[/code]
sample call:
var screenWidth = dc.getWidth();
var screenHeight = dc.getHeight();
var clockTime = Sys.getClockTime();
drawArc(dc, screenWidth/2, screenHeight/2, screenHeight/2-5, 5, (clockTime.hour/24f) * 360, 0, [Gfx.COLOR_YELLOW, Gfx.COLOR_BLACK], CLOCKWISE);
That will draw the hour hand as seen in FaceIt4rc
Image here:
Or another of my arc-filled designs: FaceIt5Arc