canvas width background image

HTML5¿¡¼­´Â ĵ¹ö½º¸¦ ÀÌ¿ëÇÏ¸é ´Ù¾çÇÑ ±×¸²À» ±×¸±¼ö ÀÖ´Ù.
Äð´Ù¿î ÀÌÆåÆ®¸¦ ±×¸®±âÀü¿¡ background  À̹ÌÁö À§¿¡ ¿øÀ» ±×·Áº»´Ù.



1. css¿¡¼­ background À̹ÌÁö¸¦ ÁöÁ¤ÇÑ´Ù.

2. html¿¡¼­ div  ´ë½Å canvas·Î À̹ÌÁö¸¦ ÁöÁ¤ÇÑ´Ù.

3. ÀÚ¹Ù½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇÏ¿© ±×¸°´Ù.

css
background À̹ÌÁö·Î "grass.jpg" À̹ÌÁö¸¦ ¼³Á¤ÇÑ´Ù.

#myCanvas {
    position: absolute;
    left: 500px;
    top: 500px;
    width: 200px;
    height: 200px;
    background:url('grass.jpg') no-repeat;
    background-size: 100% 100%;
}

html
div ´ë½Å canvas·Î ¼³Á¤Çϸé ĵ¹ö½º¿¡ ±×¸±¼ö ÀÖ´Ù.

<canvas id="myCanvas" width='200px' height='200px'></canvas> 

javascript
    var canvas = document.getElementById('myCanvas');
    var context = canvas.getContext('2d');
    var centerX = canvas.width / 2;
    var centerY = canvas.height / 2;
    var radius = 100;

    context.beginPath();
    //context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false); ¿øÀ» ±×¸®´Ù.
    context.arc(centerX, centerY, radius, 0, 1 * Math.PI, false);
    context.fillStyle = 'rgba(200,100,100,0.5)'
    context.fill();
    context.lineWidth = 10;
    context.strokeStyle = '#003300';
    context.stroke();

arc(x, y, radius, startAngle, endAngle, anticlockwise)

(x, y)¸¦ ÁßÁ¡À¸·Î ¹ÝÁö¸§ rÀ» °¡Áø´Ù.  startAngle ¿¡¼­ ½ÃÀÛÇÏ¿©, endAngle ¿¡¼­ ³¡³­´Ù
anticlockwise ¹æÇâÀ¸·Î ÇâÇÏ´Â (±âº»°ªÀº ½Ã°è¹æÇâ(clockwise)ȸÀü) ¾ÆÄ¡¸¦ ±×¸°´Ù.

µ¥¸ð:  test01.html

Âü°í)
https://developer.mozilla.org/ko/docs/Web/HTML/Canvas/Tutorial/Drawing_shapes