2017-12-14 1 views
0

이미지를 표시하려고하는데 context.fillStyle이 작동하는 데 문제가 있습니다. 팩맨이어야하지만 제대로 작동하지 않습니다. 이 문제를 해결할 수있는 도움은 매우 감사하겠습니다.context.fillStyle이 작동하지 않습니다.

 <canvas> id="canvas" width="600" height="600"> 
      <p>Sorry, your browser doesnt understand the canvas element</p> 
     </canvas> 

     <script> 
      var canvas; 
      var context; 
      canvas = document.getelementbyid('canvas'); 
      context = canvas.getContent('2d'); 
      function drawCharacter() { 
       context.beginPath(); 
       context.moveTo(118, 118); 
       context.lineTo(227, 73); 
       context.bezierCurveTo(209, 30, 167, 0, 118, 0); 
       context.bezierCurveTo(53, 0, 0.5, 53, 0, 118); 
       context.bezierCurveTo(0, 183, 53, 235, 118, 235); 
       context.bezierCurveTo(159, 235, 195, 215, 216, 183); 
       context.lineTo(118, 118); 
       context.closePath(); 
       context.fillStyle() = "rgb(249, 243, 161)"; 
       context.fill(); 
       context.stroke(); 
       context.beginPath(); 
       context.arc(118, 60, 10, 0, 2*Math.PI, false); 
       context.fillStyle() = "rgb(0, 0, 0)"; 
       context.fill(); 
      } 
      drawcharacter(); 
     </script> 

답변

관련 문제