2020-01-14
정리
: Javascript30을 공부한 내용 기록
Canvas 엘리먼트는 그래픽을 그리기위한 수단을 제공한다. 무엇보다도 애니메이션, 게임 그래픽, 데이터 시각화, 사진 조작 및 실시간 비디오 처리를 위해 사용된다.
<html>
<!-- //... -->
<canvas id="draw" width="800" height="800"></canvas>
<!-- //... -->
</html>
HTML [canvas](https://developer.mozilla.org/ko/docs/Web/HTML/Canvas) element를 사용할 때 getContext 메소드는 캔버스의 드로잉 컨텍스트를 반환한다.
const canvas = document.querySelector('#draw');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
ctx.strokeStyle = '#BADA55';
ctx.lineJoin = 'round';
ctx.lineCap = 'round';
ctx.lineWidth = 100;
// ctx.globalCompositeOperation = 'multiply';
👋