function makeBug(x, y, color){

       color1 = color;
       alpha = ".5";

       //http://www.w3schools.com/tags/canvas_globalalpha.asp
       context.globalAlpha = alpha;



       /*--  --*/
        context.beginPath();
       context.moveTo(x+5, y+21);
       context.bezierCurveTo(x, y+10, x, y+30, x+5, y+8);
       context.moveTo(x+5, y+21);
       context.bezierCurveTo(x+10, y+10, x+10, y+30, x+5, y+8);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       /*-- head --*/
       context.beginPath();
       context.arc(x+5, y+25, 7, 0, 4*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       /*-- eyes --*/
       context.beginPath();
       context.arc(x+7, y+23, 1, 0, 4*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color1;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.arc(x+2, y+23, 1, 0, 4*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color1;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       /*-- body --*/
       context.beginPath();
       context.arc(x+5, y+42, 7, 0, 1.0*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.rect(x-1, y+30,12,12);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       /*-- legs --*/
       context.beginPath();
       context.moveTo(x+11, y+32);
       context.lineTo(x+20, y+32);
       context.lineWidth = 3;
       context.stroke();
       context.beginPath();
       context.moveTo(x+11, y+38);
       context.lineTo(x+20, y+38);
       context.stroke();
       context.beginPath();
       context.moveTo(x-11, y+32);
       context.lineTo(x-2, y+32);
       context.stroke();
       context.beginPath();
       context.moveTo(x-11, y+38);
       context.lineTo(x-2, y+38);
       context.stroke();
       context.beginPath();
       context.moveTo(x+11, y+45);
       context.lineTo(x+16, y+50);
       context.stroke();
       context.beginPath();
       context.moveTo(x-2, y+45);
       context.lineTo(x-7, y+50);
       context.stroke();
   }
/*------------------------------------
  Function to draw the bug on canvas.
--------------------------------------*/
Function to draw the bug on canvas.
Function to draw the bug on canvas .
function makeBug(x, y, color){
       color1 = color;
       alpha = ".5";
       context.globalAlpha = alpha;
        context.beginPath();
       context.moveTo(x+5, y+21);
       context.bezierCurveTo(x, y+10, x, y+30, x+5, y+8);
       context.moveTo(x+5, y+21);
       context.bezierCurveTo(x+10, y+10, x+10, y+30, x+5, y+8);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.arc(x+5, y+25, 7, 0, 4*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.arc(x+7, y+23, 1, 0, 4*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color1;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.arc(x+2, y+23, 1, 0, 4*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color1;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.arc(x+5, y+42, 7, 0, 1.0*Math.PI);
       context.moveTo(x+5, y+21);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.rect(x-1, y+30,12,12);
       context.fillStyle = color;
       context.lineWidth = 1;
       context.strokeStyle = "#996633"
       context.stroke();
       context.fill();
       context.beginPath();
       context.moveTo(x+11, y+32);
       context.lineTo(x+20, y+32);
       context.lineWidth = 3;
       context.stroke();
       context.beginPath();
       context.moveTo(x+11, y+38);
       context.lineTo(x+20, y+38);
       context.stroke();
       context.beginPath();
       context.moveTo(x-11, y+32);
       context.lineTo(x-2, y+32);
       context.stroke();
       context.beginPath();
       context.moveTo(x-11, y+38);
       context.lineTo(x-2, y+38);
       context.stroke();
       context.beginPath();
       context.moveTo(x+11, y+45);
       context.lineTo(x+16, y+50);
       context.stroke();
       context.beginPath();
       context.moveTo(x-2, y+45);
       context.lineTo(x-7, y+50);
       context.stroke();
   }
function makeBug ( x , y , color ) { color1 = color ; alpha = ".5" ; context . globalAlpha = alpha ; context . beginPath ( ) ; context . moveTo ( x + 5 , y + 21 ) ; context . bezierCurveTo ( x , y + 10 , x , y + 30 , x + 5 , y + 8 ) ; context . moveTo ( x + 5 , y + 21 ) ; context . bezierCurveTo ( x + 10 , y + 10 , x + 10 , y + 30 , x + 5 , y + 8 ) ; context . fillStyle = color ; context . lineWidth = 1 ; context . strokeStyle = "#996633" context . stroke ( ) ; context . fill ( ) ; context . beginPath ( ) ; context . arc ( x + 5 , y + 25 , 7 , 0 , 4 * Math . PI ) ; context . moveTo ( x + 5 , y + 21 ) ; context . fillStyle = color ; context . lineWidth = 1 ; context . strokeStyle = "#996633" context . stroke ( ) ; context . fill ( ) ; context . beginPath ( ) ; context . arc ( x + 7 , y + 23 , 1 , 0 , 4 * Math . PI ) ; context . moveTo ( x + 5 , y + 21 ) ; context . fillStyle = color1 ; context . lineWidth = 1 ; context . strokeStyle = "#996633" context . stroke ( ) ; context . fill ( ) ; context . beginPath ( ) ; context . arc ( x + 2 , y + 23 , 1 , 0 , 4 * Math . PI ) ; context . moveTo ( x + 5 , y + 21 ) ; context . fillStyle = color1 ; context . lineWidth = 1 ; context . strokeStyle = "#996633" context . stroke ( ) ; context . fill ( ) ; context . beginPath ( ) ; context . arc ( x + 5 , y + 42 , 7 , 0 , 1.0 * Math . PI ) ; context . moveTo ( x + 5 , y + 21 ) ; context . fillStyle = color ; context . lineWidth = 1 ; context . strokeStyle = "#996633" context . stroke ( ) ; context . fill ( ) ; context . beginPath ( ) ; context . rect ( x - 1 , y + 30 , 12 , 12 ) ; context . fillStyle = color ; context . lineWidth = 1 ; context . strokeStyle = "#996633" context . stroke ( ) ; context . fill ( ) ; context . beginPath ( ) ; context . moveTo ( x + 11 , y + 32 ) ; context . lineTo ( x + 20 , y + 32 ) ; context . lineWidth = 3 ; context . stroke ( ) ; context . beginPath ( ) ; context . moveTo ( x + 11 , y + 38 ) ; context . lineTo ( x + 20 , y + 38 ) ; context . stroke ( ) ; context . beginPath ( ) ; context . moveTo ( x - 11 , y + 32 ) ; context . lineTo ( x - 2 , y + 32 ) ; context . stroke ( ) ; context . beginPath ( ) ; context . moveTo ( x - 11 , y + 38 ) ; context . lineTo ( x - 2 , y + 38 ) ; context . stroke ( ) ; context . beginPath ( ) ; context . moveTo ( x + 11 , y + 45 ) ; context . lineTo ( x + 16 , y + 50 ) ; context . stroke ( ) ; context . beginPath ( ) ; context . moveTo ( x - 2 , y + 45 ) ; context . lineTo ( x - 7 , y + 50 ) ; context . stroke ( ) ; }
Function to draw the bug on canvas.
Function to draw the bug on canvas .
//http://www.w3schools.com/tags/canvas_globalalpha.asp /*--  --*/ /*-- head --*/ /*-- eyes --*/ /*-- body --*/ /*-- legs --*/