[miniProjects] 19_Theme Clock

๋ณด๋ฆฌยท2023๋…„ 6์›” 16์ผ
0

miniProjects

๋ชฉ๋ก ๋ณด๊ธฐ
20/47

19_Theme Clock

๐Ÿ’ป ์ฃผ์ œ : ํ˜„์žฌ์‹œ๊ฐ์„ ๋ณด์—ฌ์ฃผ๊ณ  ์‹œ๊ณ„๋ฐ”๋Š˜์ด ์›€์ง์ด๋Š” ์‹œ๊ณ„ + ๋‹คํฌ๋ชจ๋“œ

  • x์ถ•์œผ๋กœ -50%, y์ถ•์œผ๋กœ-100% ๊นŒ์ง€ ์ด๋™์‹œํ‚ค๊ณ  ํšŒ์ „ ์‹œํ‚ฌ๊ฑฐ์ž„.


  transform: translate(-50%, -100%) rotate(0deg);

โ—transform

  • Element๋ฅผ ๋ณ€๊ฒฝ์‹œํ‚ฌ ๋•Œ ์‚ฌ์šฉ ( ์œ„์น˜ ์ด๋™ , ํšŒ์ „ , ํฌ๊ธฐ ์กฐ์ ˆ ๋“ฑ )
  • transform ๋‚ด ์‚ฌ์šฉ : translate , scale , rotate ๋“ฑ

โ—translate

  • Element๋ฅผ ์ด๋™์‹œํ‚ฌ ๋•Œ ์‚ฌ์šฉ
  • X์ถ•์ด๋‚˜ Y์ถ• ๊ธฐ์ค€์œผ๋กœ ํ•œ ๊ฐ’๋งŒ ์ ์šฉ์‹œํ‚ค๊ณ  ์‹ถ์„ ๋•Œ๋Š” translateY , translateY๋ฅผ ์‚ฌ์šฉํ•˜๋˜๊ฐ€ translate์—์„œ ์›ํ•˜์ง€ ์•Š๋Š” ๊ฐ’์— 0์„ ์‚ฌ์šฉํ•ด๋„ ๋œ๋‹ค.

โ—transition

  • Element์˜ CSS ์†์„ฑ์„ ๋ณ€๊ฒฝํ•  ๋•Œ ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์›€์ง์ด๊ฑฐ๋‚˜ ์›ํ•˜๋Š” ๋Œ€๋กœ ์ ์šฉ๋˜๋„๋ก ์• ๋‹ˆ๋ฉ”์ด์…˜ ์†๋„, ๋ฐ˜๋ณต ํšŸ์ˆ˜, ์กฐ์ ˆ ๋“ฑ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • dark ํด๋ž˜์Šค๋ฅผ ๋งŒ๋“ค์–ด add, remove๋กœ ๋‹คํฌ๋ชจ๋“œ์™€ ๋ผ์ดํŠธ๋ชจ๋“œ๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Œ.
  • ์‹œ๊ณ„๋Š” 360๋„ ํšŒ์ „ํ•˜๊ธฐ ๋•Œ๋ฌธ์— 0~360๊นŒ์ง€ ๋งคํ•‘(์‹œ๋Š” 12, ๋ถ„์€ 60, ์ดˆ๋Š” 60)
hourEl.style.transform = `translate(-50%, -100%) rotate(${scale(hoursForClock, 0, 12, 0, 360)}deg)`;
  minuteEl.style.transform = `translate(-50%, -100%) rotate(${scale(minutes, 0, 60, 0, 360)}deg)`;
  secondEl.style.transform = `translate(-50%, -100%) rotate(${scale(seconds, 0, 60, 0, 360)}deg)`;
profile
์ •์‹ ์ฐจ๋ ค ์ด ๊ฐ๋ฐ•ํ•œ ์„ธ์ƒ์†์—์„œ

0๊ฐœ์˜ ๋Œ“๊ธ€