이제 템플릿이 준비됐으니 그림을 그려 봅시다. 먼저 캔버스 중앙에 녹색 원을 그리겠습니다.
TODO
주석을 다음 행으로 교체하십시오.
var
c
=
Shape
.
Circle
(
200
,
200
,
50
);
c
.
fillColor
= '
green
';
브라우저를 새로고침 하니 녹색 원이 나타났습니다. 사실 이 두 행에서는 아주 많은 일을 하지
만, 지금 알아야 할 것은 몇 가지뿐입니다. 첫 번째 행은 원
객체
를 만들고, 객체를 만들기 위해
매개변수
세 가지를 받습니다. 여기서 받은 매개변수는 원 중앙의
x
,
y
좌표와 원의 반지름입
니다. 캔버스의 너비와 높이가 각각
400
픽셀이었으므로 캔버스의 중심은 (
200
,
200
)입니다.
반지름
50
픽셀은 캔버스의 너비와 높이의
8
분의
1
입니다. 두 번째 행에서는 채울 색깔(
fill
)을
정했습니다. 이 색깔은
Paper
.
js
에서
스트로크
stroke ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.