0 喜欢

tabbar液体滴落效果

admin
admin
2021-11-14 22:37:05 阅读 48

效果预览

See the Pen tabbar_liquid_effect by pdslly (@pdslly) on CodePen.

CSS代码参考

* {
  padding: 0;
  margin: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  justify-content: center;
  align-content: center;
  background-color: #fc5c65;
}

.bar {
  padding: 0 10px;
  display: grid;
  column-gap: 10px;
  grid-template-rows: 60px;
  grid-template-columns: 60px;
  grid-auto-flow: column;
  background-color: #fff;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  box-shadow: 3px 3px 0px 0px rgb(235 59 90);
}

.bar-item {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  overflow: hidden;
}

.bar-item>i {
  color: #a4b0be;
  font-size: 24px;
  transition: color 500ms linear;
  transition-delay: 1.2s;
}

.fluid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0px;
  background-color: #fc5c65;
}

.fluid::before,
.fluid::after {
  position: absolute;
  top: 0;
  content: "";
  width: 100%;
  height: 200%;
  background-color: #fff;
}

.fluid::before {
  left: -50%;
  border-top-right-radius: 50%;
}

.fluid::after {
  left: 50%;
  border-top-left-radius: 50%;
}

.drop {
  position: absolute;
  top: -2px;
  left: calc(50% - 1px);
  width: 2px;
  height: 2px;
  background-color: #fc5c65;
}

.bar-item:hover .fluid {
  animation: fluid 1s ease-in-out;
}

.bar-item:hover .drop {
  animation: drop 1s linear;
  animation-delay: 0.2s;
}

.bar-item:hover i {
  color: #fc5c65;
}

@keyframes fluid {
  0% {
    height: 0px;
  }

  30% {
    height: 10px;
  }

  100% {
    height: 0px;
  }
}

@keyframes drop {
  100% {
    top: 20px;
  }
}

关于作者
admin
admin
admin@ifront.net
 获得点赞 44
 文章阅读量 50024
文章标签