SlideShare a Scribd company logo
1 of 19
HTML Study 1 / 2 주차
- canvas 
- context 
- line 
- curves 
- rect 
- gradient 
-overlay 
- transform 
- shadow 
- pattern
canvas 
Canvas 안에 메세지를 넣어두면 Canvas 를 
지원하지 않는 브라우저에서 대체 문구를 
내보낼 수 있음 
width, height 대신 style = “width: n; height : n;” 
을 사용하면 이상하게 화면이 늘어남
canvas
canvas
canvas 
기본 형식 : 
캔버스 안에서 사용할 함수는 캔버스 동작 함수 내의 내부 
함수로 정의
rect
draw line 
선 그리기 
시작 
선 그리기 
종료 
이 부분이 
없으면 모든 
그림을 연결 
호출 해야만 선이 
표시
line
curves 
기준점1 기준점2 
원점 
종료점 
원점은 현재 위치로 커브 함수에 들어가지 않는다. 
- 각각 기준점 1 의 x, y, 기준점 2 의 x, y, 종료점의 x, y 
- quadratic 은 커브가 한번이라 기준점 2 의 좌표가 생략
arc 
마지막 커서 x1, y1 
x2, y2 
p1좌표, p2 좌표,반지름 호의반지름
gradient 
(50, 50) 
(100, 100)
overlay 
낑겨 넣기? 
디폴트 : source-over 순서대로 쌓기 
destination-over 역순으로 쌓기 
먼저 그려진 객체 : destination 
나중에 그려진 객체 : source 
ex > 
source-in : 나중에 그려진 객체 중 영역이 겹치는 부분만 
destination-out : 먼저 그려진 객체 중 영역이 겹치지 않는 부분만
transform1 
두번째 인자가 -0.2 세번째 인자가 -0.2
transform2 
1 . 중심점을 가운데로 옮겨서 
2. 시계방향으로 45 도를 틀어서 
3. 가로만 두배로 늘린다 
1. 중점 이동 
(50, 50) 
(0, 0) 
2. 45 도 회전 
3. 가로 x 2
shadow 
setOffsetX, setOffsetY 는 pixel 단위이며, 제한 없음 
context.shadowBlur=2000;
clip 
전체 영역 중에서 50, 50 만 사용하겠다는 의미. 
아래 코드에 모두 영향을 미치므로 
context.save() / context.restore() 와 함께 사용한다
pattern
pattern 
no-repeat >> 원본 repeat-x 
repeat-y repeat

More Related Content

What's hot (8)

마칭 큐브 알고리즘 - ZP 2019 데캠
마칭 큐브 알고리즘 - ZP 2019 데캠마칭 큐브 알고리즘 - ZP 2019 데캠
마칭 큐브 알고리즘 - ZP 2019 데캠
 
유니티 고급 과정 -3-
유니티 고급 과정 -3-유니티 고급 과정 -3-
유니티 고급 과정 -3-
 
정점 변환
정점 변환정점 변환
정점 변환
 
Gpu Gems 2 Chapter 15 Sketchy Rendering
Gpu Gems 2 Chapter 15 Sketchy RenderingGpu Gems 2 Chapter 15 Sketchy Rendering
Gpu Gems 2 Chapter 15 Sketchy Rendering
 
IndirectDraw with unity
IndirectDraw with unityIndirectDraw with unity
IndirectDraw with unity
 
[Week15] D3.js_Scatter_Chart
[Week15] D3.js_Scatter_Chart[Week15] D3.js_Scatter_Chart
[Week15] D3.js_Scatter_Chart
 
Rendering realistic Ice objects
Rendering realistic Ice objectsRendering realistic Ice objects
Rendering realistic Ice objects
 
[week16] D3.js_Transition
[week16] D3.js_Transition[week16] D3.js_Transition
[week16] D3.js_Transition
 

Similar to Html5 canvas study week1n2

Matplotlib 기초 이해하기_20160730
Matplotlib 기초 이해하기_20160730Matplotlib 기초 이해하기_20160730
Matplotlib 기초 이해하기_20160730
Yong Joon Moon
 
Depth buffershadow
Depth buffershadowDepth buffershadow
Depth buffershadow
MoonLightMS
 
[1023 박민수] 깊이_버퍼_그림자_1
[1023 박민수] 깊이_버퍼_그림자_1[1023 박민수] 깊이_버퍼_그림자_1
[1023 박민수] 깊이_버퍼_그림자_1
MoonLightMS
 
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
종빈 오
 
노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)
QooJuice
 

Similar to Html5 canvas study week1n2 (17)

이정근_project_로봇비전시스템.pdf
이정근_project_로봇비전시스템.pdf이정근_project_로봇비전시스템.pdf
이정근_project_로봇비전시스템.pdf
 
Python+numpy pandas 2편
Python+numpy pandas 2편Python+numpy pandas 2편
Python+numpy pandas 2편
 
Voxel based game_optimazation_relelase
Voxel based game_optimazation_relelaseVoxel based game_optimazation_relelase
Voxel based game_optimazation_relelase
 
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
[IGC2018] 유영천 개발자 - Voxel기반 네트워크 게임 최적화기법
 
5-1. html5 graphics
5-1. html5 graphics5-1. html5 graphics
5-1. html5 graphics
 
Bump Mapping
Bump MappingBump Mapping
Bump Mapping
 
gv008 ver0.1
gv008 ver0.1gv008 ver0.1
gv008 ver0.1
 
CSS Functions
CSS FunctionsCSS Functions
CSS Functions
 
Matplotlib 기초 이해하기_20160730
Matplotlib 기초 이해하기_20160730Matplotlib 기초 이해하기_20160730
Matplotlib 기초 이해하기_20160730
 
Depth buffershadow
Depth buffershadowDepth buffershadow
Depth buffershadow
 
[1023 박민수] 깊이_버퍼_그림자_1
[1023 박민수] 깊이_버퍼_그림자_1[1023 박민수] 깊이_버퍼_그림자_1
[1023 박민수] 깊이_버퍼_그림자_1
 
[1023 박민수] 깊이_버퍼_그림자
[1023 박민수] 깊이_버퍼_그림자[1023 박민수] 깊이_버퍼_그림자
[1023 박민수] 깊이_버퍼_그림자
 
Deep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNetDeep Learning Into Advance - 1. Image, ConvNet
Deep Learning Into Advance - 1. Image, ConvNet
 
NDC11_슈퍼클래스
NDC11_슈퍼클래스NDC11_슈퍼클래스
NDC11_슈퍼클래스
 
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
 
스위프트 성능 이해하기
스위프트 성능 이해하기스위프트 성능 이해하기
스위프트 성능 이해하기
 
노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)노말 맵핑(Normal mapping)
노말 맵핑(Normal mapping)
 

More from Juneyoung Oh (7)

Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
 
Docker 사내교육 자료
Docker 사내교육 자료Docker 사내교육 자료
Docker 사내교육 자료
 
휴봇-슬랙 OSX 설치
휴봇-슬랙 OSX 설치휴봇-슬랙 OSX 설치
휴봇-슬랙 OSX 설치
 
How to build a slack-hubot with js
How to build a slack-hubot with jsHow to build a slack-hubot with js
How to build a slack-hubot with js
 
Github 의 release 기능
Github 의 release 기능Github 의 release 기능
Github 의 release 기능
 
Html5 canvas6 week6n7n8
Html5 canvas6 week6n7n8Html5 canvas6 week6n7n8
Html5 canvas6 week6n7n8
 
Tizen installation guide for OSX
Tizen installation guide for OSXTizen installation guide for OSX
Tizen installation guide for OSX
 

Html5 canvas study week1n2

  • 1. HTML Study 1 / 2 주차
  • 2. - canvas - context - line - curves - rect - gradient -overlay - transform - shadow - pattern
  • 3. canvas Canvas 안에 메세지를 넣어두면 Canvas 를 지원하지 않는 브라우저에서 대체 문구를 내보낼 수 있음 width, height 대신 style = “width: n; height : n;” 을 사용하면 이상하게 화면이 늘어남
  • 6. canvas 기본 형식 : 캔버스 안에서 사용할 함수는 캔버스 동작 함수 내의 내부 함수로 정의
  • 8. draw line 선 그리기 시작 선 그리기 종료 이 부분이 없으면 모든 그림을 연결 호출 해야만 선이 표시
  • 10. curves 기준점1 기준점2 원점 종료점 원점은 현재 위치로 커브 함수에 들어가지 않는다. - 각각 기준점 1 의 x, y, 기준점 2 의 x, y, 종료점의 x, y - quadratic 은 커브가 한번이라 기준점 2 의 좌표가 생략
  • 11. arc 마지막 커서 x1, y1 x2, y2 p1좌표, p2 좌표,반지름 호의반지름
  • 12. gradient (50, 50) (100, 100)
  • 13. overlay 낑겨 넣기? 디폴트 : source-over 순서대로 쌓기 destination-over 역순으로 쌓기 먼저 그려진 객체 : destination 나중에 그려진 객체 : source ex > source-in : 나중에 그려진 객체 중 영역이 겹치는 부분만 destination-out : 먼저 그려진 객체 중 영역이 겹치지 않는 부분만
  • 14. transform1 두번째 인자가 -0.2 세번째 인자가 -0.2
  • 15. transform2 1 . 중심점을 가운데로 옮겨서 2. 시계방향으로 45 도를 틀어서 3. 가로만 두배로 늘린다 1. 중점 이동 (50, 50) (0, 0) 2. 45 도 회전 3. 가로 x 2
  • 16. shadow setOffsetX, setOffsetY 는 pixel 단위이며, 제한 없음 context.shadowBlur=2000;
  • 17. clip 전체 영역 중에서 50, 50 만 사용하겠다는 의미. 아래 코드에 모두 영향을 미치므로 context.save() / context.restore() 와 함께 사용한다
  • 19. pattern no-repeat >> 원본 repeat-x repeat-y repeat