| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- typescript
- CSS
- canvas
- HttpOnly Cookie
- JS
- ๋ ธ๋ง๋์ฝ๋
- react
- javascript
- ๋ ธ๋ง๋ ์ฝ๋
- canvas js
- ์ฝ์ฝ์ํก ํด๋ก ์ฝ๋ฉ
- ์ํ์ฝ๋ฉ
- ํ๋ก ํธ์๋
- ์ฝ๋ฉ๋ ํ
- jest
- tailwindcss
- BFF ์ํคํ ์ฒ
- JAVA Script
- ๋ฐ๋๋ผ JS๋ก ๊ทธ๋ฆผํ ๋ง๋ค๊ธฐ
- HTML
- cookie ๋ณด์
- HttyOnly Cookie
- cookie ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- next.js
- clone coding
- ๋ฐ๋๋ผ JS๋ก ํฌ๋กฌ ์ฑ ๋ง๋ค๊ธฐ
- ํ๋ก์ ์ํคํ ์ฒ
- ์ฝ๋ฉ์ผ๊ธฐ
- BFF์ํคํ ์ฒ
- canvas image
- Today
- Total
๋ชฉ๋ก๐ป Programming/Java Script (7)
Coding Archive
saving canvas painting ์บ๋ฒ์ค์ ๊ทธ๋ฆฐ ๊ทธ๋ฆผ์ ์ ์ฅํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด๊ฒ ์ต๋๋ค. [ html / css ] 1 2 3 4 save image Colored by Color Scripter cs html์์ ์บ๋ฒ์ค์ ์ธ์ด๋ธ ๋ฒํผ์ ๋ง๋ค์ด ์ค๋๋ค. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 body { padding: 44px; display: flex; flex-direction: column; align-items: center; background-color: #f7f7f7; } canvas { background-color: white; border-radius: 5%; bo..
canvas drawing image ์บ๋ฒ์ค์ ์ฌ์ง์ ์ฒจ๋ถํ ์ ์๋ ๋ฐฉ๋ฒ์ ์์๋ณด๊ฒ ์ต๋๋ค. [ html / css ] 1 2 3 4 Colored by Color Scripter cs accept ์์ฑ์ ์ถ๊ฐํด ์ฒจ๋ถํ๋ ค๋ file์ ํน์ ํ ์ ์์ต๋๋ค. (accept="image/*" ->๋ชจ๋ ์ด๋ฏธ์ง ํ์ผ์ ํ์ฉํ๋ค๋ ์๋ฏธ) ์ด๋ ๊ฒ input file์ ๋ง๋ค๊ฒ ๋๋ฉด ์์ ๊ธฐ๋ณธ ์คํ์ผ์ฒ๋ผ ๊ทธ๋ ค์ง๊ฒ ๋ฉ๋๋ค. ํ์ง๋ง css๋ฅผ ๋ณ๊ฒฝํ ์ ์๊ธฐ ๋๋ฌธ์ ์คํ์ผ์ ๋ณ๊ฒฝํ๊ณ ์ถ์ ๊ฒฝ์ฐ๋ผ๋ฉด label์ ์ฌ์ฉํด ํด๊ฒฐํ ์ ์์ต๋๋ค. 1 2 3 4 5 6 7 Add Photo Colored by Color Scripter cs ๋ผ๋ฒจ ํ๊ทธ์ for ์์ฑ์ ์ด์ฉํด input file ํ๊ทธ์ ์ฐ๊ฒฐ์ ์์ผ์ฃผ๋ฉด, label์ ํด๋ฆญ..
canvas drawing text ์บ๋ฒ์ค์ ๋๋ธํด๋ฆญ์ผ๋ก ๊ฐ๋จํ๊ฒ ์ํ๋ ํ ์คํธ๋ฅผ ์ถ๋ ฅํ ์ ์๋ ํจ์๋ฅผ ๊ตฌํํด๋ณด์์ต๋๋ค. [ html / css ] 1 2 3 4 Colored by Color Scripter cs html์์ ์บ๋ฒ์ค, ํ์ ์ด ํ ์คํธ์ธ ์ธํ์ ๋ง๋ค์ด ์ค๋๋ค. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 body { padding: 50px; display: flex; flex-direction: column; align-items: center; background-color: rgba(0, 0, 0, 0.05); } canvas { ..
canvas color palette ๊ฐ๋จํ๊ฒ ๋ธ๋ฌ์ ์์์ ๋ฐ๊พธ๋ ํจ์๋ฅผ ๋ง๋ค์ด ๋ณด์์ต๋๋ค. [ html ] 1 2 3 4 5 6 7 8 9 10 11 12 Colored by Color Scripter cs div๋ฅผ ์ฌ์ฉํด ์ํ๋ color๋ค์ ๋ง๋ค์ด ์ค๋๋ค. [ js ] 1. 1 const colors = document.querySelectorAll(".color"); cs querySelector๋ ์๋ง์ color div ์ค ์ค์ง ๋งจ ์ฒ์ ํ๋์ div๋ง ์ ํํฉ๋๋ค. ์ด๋ด ๋ ์ฌ์ฉ ๊ฐ๋ฅํ ๊ฑด querySelectorAll์ ๋๋ค. All์ด ๋ถ์ผ๋ฉด ํ๋๊ฐ ์๋ ๋ชจ๋ color div๋ฅผ ์ ํํ ์ ์์ด getElementsByClassName๊ณผ ๊ฐ์ ํจ๊ณผ๋ฅผ ๋ณผ ์ ์์ต๋๋ค. 2. 1 2 3 4 5 ..
canvas drawing mode๋ณ๊ฒฝํ๊ธฐ(fill/draw) ๊ธฐ๋ณธ ์ํ๋ draw ์ํ์ง๋ง fill ๋ฒํผ์ ๋๋ฅด๋ฉด canvas์ ์์ ์ฑ์ธ ์ ์๋๋ก ๋ง๋ค์ด ๋ดค์ต๋๋ค. 1 . html ์์ ์ ํ, ์ ๊ทผํ๊ธฐ 1 const modeBtn = document.querySelector(".modeBtn"); cs querySelector๋ฅผ ์ฌ์ฉํด ์ํ๋ html ์์๋ฅผ ์ฐพ์ต๋๋ค. 2 . ๋ฒํผ์ ํด๋ฆญ ์ด๋ฒคํธ ์ฃผ๊ธฐ / ๋ชจ๋ ๋ณํ ํจ์ ๊ตฌํํ๊ธฐ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 const modeBtn = document.querySelector(".modeBtn"); let filling = false; function onModeClick() { if (!filling) { ..
canvas js๋ก ๊ตฌํํ๊ธฐ ์์ ๋ฐฐ์ด ๋ด์ฉ์ ๋ฐํ์ผ๋ก js์์ ๊ทธ๋ฆฌ๊ธฐ ํจ์๋ฅผ ๋ง๋ค์ด canvas๋ฅผ ๊ตฌํํด ๋ณด์์ต๋๋ค. · html / css html์์ id๊ฐ canvas์ธ canvas ํ๊ทธ๋ฅผ ์์ฑํฉ๋๋ค. 1 cs ์ํ๋ ๋์์ธ๋๋ก css๋ฅผ ์์ฑํฉ๋๋ค. 1 2 3 4 5 6 7 8 #canvas { height: 700px; width: 1000px; background-color: white; border-radius: 50px; box-shadow: var(--box-shadow); margin: 0 30px; } Colored by Color Scripter cs · js 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 const canvas = docume..
2D Context canvas๋ context๋ฅผ ๊ฐ๊ณ ์๋ html ์์๋ก, context๋ canvas ์์์ ํฝ์ ์ ๋ค๋ฃจ๋ ๊ฒ์ ๋๋ค. context๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด์๋ canvas๋ getContext() ๋ฉ์๋๊ฐ ํ์ํ๊ณ , ์ด ๋ฉ์๋๋ฅผ ํตํด canvas์ ๊ทธ๋ฆผ์ ๊ทธ๋ฆด ์ ์์ต๋๋ค. 2d ๊ทธ๋ํฝ์ ๊ฒฝ์ฐ "2d"๋ฅผ ๋ฃ์ด์ค๋๋ค. 1 const ctx = canvas.getContext("2d"); cs canvas ํฌ๊ธฐ ์ค์ canvas ํฌ๊ธฐ ์ค์ ์ css์์ ์ง์ ํ ๊ฒ๊ณผ ๋ณ๋๋ก ๋ค์ ์ง์ ํด์ค์ผ ํฉ๋๋ค. 1 2 canvas.width = 700; canvas.height = 700; cs * ์ด๋ ๊ฒ ๋ฐ๋ก ์ง์ ํ๋ ์ผ์ด ์๋๋ก ํ๊ธฐ ์ํด๏ผcanvas id="jsCanvas" width="700" heig..