draw_omega.js 500 B

12345678910111213141516171819
  1. var drawOmega = function (ctx, outerCircleColor, innerCircleColor) {
  2. ctx.globalCompositeOperation = "source-over";
  3. ctx.fillStyle = outerCircleColor;
  4. ctx.beginPath();
  5. ctx.arc(0.5, 0.5, 0.5, 0, Math.PI * 2, true);
  6. ctx.closePath();
  7. ctx.fill();
  8. if (innerCircleColor != null) {
  9. ctx.fillStyle = innerCircleColor;
  10. } else {
  11. ctx.globalCompositeOperation = "destination-out";
  12. }
  13. ctx.beginPath();
  14. ctx.arc(0.5, 0.5, 0.25, 0, Math.PI * 2, true);
  15. ctx.closePath();
  16. ctx.fill();
  17. };