使用css写一个水滴下落的动画

109 阅读1分钟

"```markdown 使用CSS写一个水滴下落的动画

<div class=\"container\">
  <div class=\"drop\"></div>
</div>
.container {
  position: relative;
  height: 500px;
  background-color: #f0f0f0;
}

.drop {
  position: absolute;
  width: 100px;
  height: 100px;
  background-color: #00aaff;
  border-radius: 50%;
  animation: dropAnimation 2s ease-in-out infinite;
}

@keyframes dropAnimation {
  0% {
    top: 0;
  }
  50% {
    top: 400px;
    transform: scale(0.7);
    background-color: #0066cc;
  }
  100% {
    top: 500px;
    transform: scale(0.5);
    background-color: #003366;
  }
}
.container {
  position: relative;
  height: 500px;
  background-color: #f0f0f0;
}

.drop {
  position: absolute;
  width: 100px;
  height: 100px;
  background-color: #00aaff;
  border-radius: 50%;
  animation: dropAnimation 2s ease-in-out infinite;
}

@keyframes dropAnimation {
  0% {
    top: 0;
  }
  50% {
    top: 400px;
    transform: scale(0.7);
    background-color: #0066cc;
  }
  100% {
    top: 500px;
    transform: scale(0.5);
    background-color: #003366;
  }
}
.container {
  position: relative;
  height: 500px;
  background-color: #f0f0f0;
}

.drop {
  position: absolute;
  width: 100px;
  height: 100px;
  background-color: #00aaff;
  border-radius: 50%;
  animation: dropAnimation 2s ease-in-out infinite;
}

@keyframes dropAnimation {
  0% {
    top: 0;
  }
  50% {
    top: 400px;
    transform: scale(0.7);
    background-color: #0066cc;
  }
  100% {
    top: 500px;
    transform: scale(0.5);
    background-color: #003366;
  }
}
.container {
  position: relative;
  height: 500px;
  background-color: #f0f0f0;
}

.drop {
  position: absolute;
  width: 100px;
  height: 100px;
  background-color: #00aaff;
  border-radius: 50%;
  animation: dropAnimation 2s ease-in-out infinite;
}

@keyframes dropAnimation {
  0% {
    top: 0;
  }
  50% {
    top: 400px;
    transform: scale(0.7);
    background-color: #0066cc;
  }
  100% {
    top: 500px;
    transform: scale(0.5);
    background-color: #003366;
  }
}