본문 바로가기
Coding/HTML & CSS

[Html & CSS] css를 활용하여 움직이는 효과 만드는 방법 !!

by 포스트it 2023. 7. 24.
728x90
반응형

 

[Html & CSS] css를 활용하여 움직이는 효과 만드는 방법 !!

물결이 치는 것처럼 div박스를 만들어봤습니다 ㅎ

 

예제코드
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Wave Animation</title>
  <style>
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  background-color: #f5f5f5;
}

.wave-container {
  position: relative;
  width: 200px;
  height: 150px; /* 물결의 높이를 조절할 수 있습니다. */
  overflow: hidden;
}

.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #00bcd4;
  opacity: 0.7;
  transform-origin: center bottom;
  animation: waveAnimation 4s linear infinite;
}

@keyframes waveAnimation {
  0%, 100% {
    transform: scaleY(0.8) translateY(30px);
  }
  50% {
    transform: scaleY(1) translateY(0);
  }
}
  </style>
</head>
<body>
  <div class="wave-container">
    <div class="wave"></div>
  </div>
</body>
</html>

결과값

728x90
반응형

댓글