비전공자 개발일기

Nine Dots Menu 본문

HTML _CSS

Nine Dots Menu

HiroDaegu 2022. 5. 11. 00:42
728x90
SMALL

 

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>9 DOTS MENU</title>
  <link rel="stylesheet" href="style.css">
  <script defer src="main.js"></script>
  <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
  <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> 
</head>
<body>
  <div class="navigation">
    <span style="--i:0;--x:-1;--y:0">
      <ion-icon name="camera-outline"></ion-icon>
    </span>
    <span style="--i:1;--x:1;--y:0">
      <ion-icon name="diamond-outline"></ion-icon>
    </span>
    <span style="--i:2;--x:0;--y:-1">
      <ion-icon name="diamond-outline"></ion-icon>
    </span>
    <span style="--i:3;--x:0;--y:1">
      <ion-icon name="diamond-outline"></ion-icon>
    </span>
    <span style="--i:4;--x:1;--y:1">
      <ion-icon name="game-controller-outline"></ion-icon>
    </span>
    <span style="--i:5;--x:-1;--y:-1">
      <ion-icon name="moon-outline"></ion-icon>
    </span>
    <span style="--i:6;--x:0;--y:0">
      <ion-icon name="notifications-outline"></ion-icon>
    </span>
    <span style="--i:7;--x:-1;--y:1">
      <ion-icon name="notifications-outline"></ion-icon>
    </span>
    <span style="--i:8;--x:1;--y:-1">
      <ion-icon name="notifications-outline"></ion-icon>
    </span>
  </div>
</body>
</html>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #10131c;
}

.navigation {
  position: relative;
  width: 70px;
  height: 70px;
  background: #212532;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: .5s;
  transition-delay: .8s;
}

.navigation.active {
  width: 200px;
  height: 200px;
  transition-delay: 0s;
}

.navigation span {
  position: absolute;
  width: 7px;
  height: 7px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 50%;
  transform: translate(calc(12px * var(--x)), calc(12px * var(--y)));
  transition: transform .5s, width .5s, height .5s, background .5s;
  transition-delay: calc(.1s * var(--i));
}

.navigation span ion-icon {
  transition: .5s;
  font-size: 0em;

}

.navigation.active span {
  width: 45px;
  height: 45px;
  background: #333849;
  transform: translate(calc(60px * var(--x)), calc(60px * var(--y)));
}

.navigation.active span ion-icon {
  font-size: 1.35em;
  color: #fff;
}

.navigation.active span:hover ion-icon {
  color: #2dfc52;
  filter:drop-shadow(0 0 2px #2dfc52) drop-shadow(0 0 5px #2dfc52) drop-shadow(0 0 15px #2dfc52); 
}
let navigation = document.querySelector(".navigation");
navigation.onclick = function() {
  navigation.classList.toggle("active");
}
728x90
LIST

'HTML _CSS' 카테고리의 다른 글

Sprite Animation  (0) 2022.05.18
Image Animation Sequence  (0) 2022.05.13
3D BUTTON  (0) 2022.05.09
Floating Text  (0) 2022.05.07
Instagram Notification Animation  (0) 2022.05.06