Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. ctx.moveTo(x,y);
  2.  
  3. context.arc(x, y, radius, i*pieAngle, (i+1)*pieAngle, false);
  4.  
  5. // size of a pie : it is an angle in radians
  6. var pieAngle = 2 * Math.PI / hours;
  7.  
  8. var hueValue = i * 15;
  9. context.fillStyle = 'hsl(' + hueValue + ',70%, 60%)';
  10.  
  11. function drawSegments(radius) {
  12. for (var i = 0; i < hours; i++) {
  13. context.beginPath();
  14. context.moveTo(x, y);
  15. context.arc(x, y, radius, i*pieAngle, (i+1)*pieAngle, false);
  16. context.lineWidth = segmentDepth;
  17. var hueValue = i * 15;
  18. context.fillStyle = 'hsl(' + hueValue + ',70%, 60%)';
  19. // '#'+(Math.random()*0xFFFFFF<<0).toString(16);
  20. context.fill();
  21. context.lineWidth = 2;
  22. context.strokeStyle = '#444';
  23. context.stroke();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement