[miniProjects] 14_Animated Navigation

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

miniProjects

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

14_Animated Navigation

๐Ÿ’ป ์ฃผ์ œ : ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ”์˜ X๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋„ค๋น„๋ฐ”๊ฐ€ ์ค„์–ด๋“ค๋ฉด์„œ ํ–„๋ฒ„๊ฑฐ ๋ฐ”๋กœ ์ „ํ™˜๋œ๋‹ค.

  • rotate๋ฅผ ํ™œ์šฉํ•œ css๊ฐ€ ๋งŽ์Œ.
  • toggle ๋ฉ”์„œ๋“œ๋ฅผ ์ด์šฉํ•ด active ํด๋ž˜์Šค๋ฅผ ๋ถ™์ด๊ฑฐ๋‚˜ ์ œ๊ฑฐํ•˜์—ฌ ๋„ค๋น„ ๋ฐ”์— ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉํ•จ.


nav ul li {
  transform: rotateY(0deg);
  opacity: 0;
  transition: transform 0.6s linear, opacity 0.6s linear;
}

nav.active ul li {
  opacity: 1;
  transform: rotateY(360deg);
}

nav.active .icon .line1 {
//์š”์†Œ๋ฅผ ๋ฐ˜์‹œ๊ณ„ ๋ฐฉํ–ฅ์œผ๋กœ ํšŒ์ „์‹œํ‚ค๊ณ  ์ˆ˜์ง์œผ๋กœ 5.5px๋งŒํผ ์ด๋™
  transform: rotate(-765deg) translateY(5.5px);
}

nav.active .icon .line2 {
//์š”์†Œ๋ฅผ ์‹œ๊ณ„ ๋ฐฉํ–ฅ์œผ๋กœ ํšŒ์ „์‹œํ‚ค๊ณ  ์ˆ˜์ง์œผ๋กœ -5.5px๋งŒํผ ์ด๋™
  transform: rotate(765deg) translateY(-5.5px);
}
profile
์ •์‹ ์ฐจ๋ ค ์ด ๊ฐ๋ฐ•ํ•œ ์„ธ์ƒ์†์—์„œ

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