๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Daily/Today I Learned

22.07.22_TIL

by ํ˜ธ๋ฐ€์ด 2022. 7. 22.

๐Ÿ“Œ ์–ด์ œ ํ•œ ๋ฏธ๋””์–ด ์ฟผ๋ฆฌ๋Š” ์žฌ๋ฏธ์žˆ์—ˆ๋‹ค. ์˜ค๋Š˜์€ ์›น ํŽ˜์ด์ง€์— ๋™์ ์ธ ํšจ๊ณผ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ์— ๋Œ€ํ•ด์„œ ํ•™์Šต์„ ํ•œ๋‹ค. ์˜ค๋Š˜๋„ ์–ด์ œ์™€ ๊ฐ™์ด ์žฌ๋ฏธ์žˆ๋Š” ์‹œ๊ฐ„์ด ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ๋‹ค.

๐Ÿ“— ์˜ค๋Š˜ ํ•™์Šตํ•œ ๋‚ด์šฉ

CSS ์• ๋‹ˆ๋ฉ”์ด์…˜

  • @keyframes
    • CSS๋กœ ํ‚คํ”„๋ ˆ์ž„ ๋ธ”๋ก์„ ๋งŒ๋“ ๋‹ค
@keyframes ์• ๋‹ˆ๋ฉ”์ด์…˜์ด๋ฆ„{
    0% {	/* from์œผ๋กœ ์ž‘์„ฑ๊ฐ€๋Šฅ */
        CSS์†์„ฑ: ์†์„ฑ๊ฐ’;
        transform: rotate(0deg)
    }
    50% {  
        CSS์†์„ฑ: ์†์„ฑ๊ฐ’;
        transform: rotate(180deg)
    }
    100% {	/* to์œผ๋กœ ์ž‘์„ฑ๊ฐ€๋Šฅ */
        CSS์†์„ฑ: ์†์„ฑ๊ฐ’;
        transform: rotate(360deg)
    }
}

/* ์‹œ์ž‘ ์‹œ์ ์—์„œ 0๋„, 50ํ”„๋กœ ์‹œ์ ์—์„œ 180๋„, ์™„๋ฃŒ์‹œ์ ์—์„œ 360๋„ ํšŒ์ „์‹œํ‚ด*/

์• ๋‹ˆ๋ฉ”์ด์…˜ ์†์„ฑ

  • animation: ๋„์–ด์“ฐ๊ธฐ๋กœ ์†์„ฑ ๋‚˜์—ด ๊ฐ€๋Šฅ
    • animation-name: ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์ค‘๊ฐ„ ์ƒํƒœ๋ฅผ ์ง€์ •ํ•˜๋Š” ์ด๋ฆ„.
#logo{
    animation: lotate;
    animation-name: lotate;
    /* ๋‘˜ ๋‹ค ์‚ฌ์šฉ๊ฐ€๋Šฅ */
}
  • animation-duration: ํ•œ ์‹ธ์ดํฌ๋ฅด์ด ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์žฌ์ƒ๋  ์‹œ๊ฐ„ ์ง€์ •
#logo{
    animation: lotate 3s;
    /* =================== */
    animation-name: lotate;
    animation-duration: 3s;
}
  • animation-delay: ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์‹œ์ž‘์„ ์ง€์—ฐ์‹œํ‚ฌ ์‹œ๊ฐ„ ์ง€์ •
#logo{
    animation-name: lotate;
    animation-duration: 3s;
    animation-delay: 3s;
}
  • animation-direction: ์• ๋‹ˆ๋ฉ”์ด์…˜ ์žฌ์ƒ ๋ฐฉํ–ฅ์„ ์ง€์ •
    • normal: ๊ธฐ๋ณธ๊ฐ’ (์žฌ์ƒ ์ข…๋ฃŒ ํ›„ ๋‹ค์‹œ ์žฌ์ƒ)
    • reverse: ์—ญ๋ฐฉํ–ฅ ์žฌ์ƒ
    • alternate: ์ˆœ๋ฐ˜ํ–ฅ๋ถ€ํ„ฐ ์—ญ๋ฐฉํ–ฅ์„ ๋ฒˆ๊ฐˆ์•„๊ฐ€๋ฉฐ ์žฌ์ƒ
    • alternate-reverse: ์—ญ๋ฐฉํ–ฅ๋ถ€ํ„ฐ ์ˆœ๋ฐ˜ํ–ฅ์„ ๋ฒˆ๊ฐˆ์•„๊ฐ€๋ฉฐ ์žฌ์ƒ
#logo{
    animation-name: lotate;
    animation-duration: 3s;
    animation-direction: arternate;
}
  • animation-iteration-count: ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ๋ช‡ ๋ฒˆ ๋ฐ˜๋ณต๋ ์ง€ ์ง€์ •
#logo{
    animation-name: lotate;
    animation-duration: 3s;
    animation-iteration-count: 3;
    /* ์• ๋‹ˆ๋ฉ”์ด์…˜ 3ํšŒ ๋ฐ˜๋ณต */
}
  • animation-play-state: ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์žฌ์ƒ ์ƒํƒœ(์ผ์‹œ์ •์ง€, ์žฌ์‹œ์ž‘)
#logo{
    animation-name: lotate;
    animation-duration: 3s;
    animation-play-state: pause;
}
  • animation-timing-function: ์ค‘๊ฐ„ ์ƒํƒœ๋“ค์˜ ์ „ํ™˜์„ ์–ด๋–ค ์‹œ๊ฐ„๊ฐ„๊ฒฉ์œผ๋กœ ์ง„ํ–‰ํ• ์ง€ ์ง€์ •
    • linear: ์ผ์ •ํ•œ ๊ฐ„๊ฒฉ
    • ease: ๊ธฐ๋ณธ๊ฐ’
    • ease-in
    • ease-out
    • ease-in-out
  • animation-fill-mode: ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์žฌ์ƒ ์ „ ํ›„์˜ ์ƒํƒœ ์ง€์ •
    • none: ๊ธฐ๋ณธ๊ฐ’
    • forwards: ๋งˆ์ง€๋ง‰ ํ‚คํ”„๋ ˆ์ž„ ์Šคํƒ€์ผ ์œ ์ง€
    • backwards: ์ฒซ ๋ฒˆ์งธ ํ‚คํ”„๋ ˆ์ž„ ์Šคํƒ€์ผ ์œ ์ง€
    • both: ์žฌ์ƒ ์ „ - ์ฒซ ๋ฒˆ์งธ ํ‚คํ”„๋ ˆ์ž„ ์Šคํƒ€์ผ, ์žฌ์ƒ ํ›„ - ๋งˆ์ง€๋ง‰ ํ‚คํ”„๋ ˆ์ž„ ์Šคํƒ€์ผ ์œ ์ง€

Canvas

  • ๋‹ค์–‘ํ•œ ๊ทธ๋ž˜ํ”ฝ ์š”์†Œ๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉํ•œ๋‹ค.
  • ๋‹จ์ˆœํ•œ ๋„ํ˜• ๊ทธ๋ฆฌ๊ธฐ, ๋ฐ์ดํ„ฐ ์‹œ๊ฐํ™”, ์• ๋‹ˆ๋ฉ”์ด์…˜, ์›น ๊ฒŒ์ž„ ๋“ฑ์— ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ์ฝ˜ํ…์ธ ๋ฅผ ๋งŒ๋“ค์–ด ๋‚ผ ์ˆ˜ ์žˆ๋‹ค.
<canvas id="canvas">
	์บ”๋ฒ„์Šค๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š๋Š” ๋ธŒ๋ผ์šฐ์ €์—์„œ๋Š” ์บ”๋ฒ„์Šค ๋Œ€์‹  ํƒœ๊ทธ ์‚ฌ์ด ๋‚ด์šฉ ํ‘œ์‹œ
</canvas>
  • ์บ”๋ฒ„์Šค ํฌ๊ธฐ ์ง€์ • (๊ธฐ๋ณธํฌ๊ธฐ 300px * 150px)
<canvas id="canvas" width="500" height="500"></canvas>

<canvas id="canvas" width="50vw" height="40vh"></canvas>

์บ”๋ฒ„์Šค๋กœ ์‚ฌ๊ฐํ˜• ๊ทธ๋ฆฌ๊ธฐ

  • ์ƒ‰์ƒ
    • ctx.fillStyle = 'blue'
    • ctx.fillRect = (10, 10, 100, 50)
  • ์„ 
    • ctx.lineWitdth = 5;
      ctx.strokeStyle = "black";
    • ctx.strokeRect(10, 10, 100, 50)
  • ์ง€์šฐ๊ธฐ
    • ctx.clearRect(20, 20, 80, 30)

๐Ÿ“˜ ์ถ”๊ฐ€๋กœ ๊ณต๋ถ€ํ•  ๋‚ด์šฉ

[udemy] React ์™„๋ฒฝ ๊ฐ€์ด๋“œ ๊ฐ•์˜ ๋ณด๊ธฐ (๋งค์ผ ์กฐ๊ธˆ์”ฉ ์ด๋ผ๋„ ๊พธ์ค€ํžˆ ๋“ฃ๊ธฐ)

Study์›๊ณผ ํ•จ๊ป˜ ์ง„ํ–‰์ค‘์ธ ํ”„๋กœ์ ํŠธ ๊ตฌํ˜„

  • ๋กœ๊ทธ์ธ ํผ ๊ตฌํ˜„

๐Ÿ“ ์ค‘์š”ํ•œ ๋‚ด์šฉ

  • CSS ์• ๋‹ˆ๋ฉ”์ด์…˜ ์‚ฌ์šฉ๋ฒ•
  • ์บ”๋ฒ„์Šค ์‚ฌ์šฉ๋ฒ•

'Daily > Today I Learned' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

22.07.26_TIL  (0) 2022.07.26
22.07.25_TIL  (0) 2022.07.25
22.07.21_TIL  (0) 2022.07.21
22.07.19_TIL  (0) 2022.07.19
22.07.18_TIL  (0) 2022.07.18