test-tube

by slawe

HTML

<div class="tube">
  <div class="shine"></div>
  <div class="body">
    <div class="liquid">
      <div class="percentage"></div>
    </div>
  </div>
  <div class="bubbles">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </div>
</div>

CSS

body {
  background-color: #abab21;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  margin: 0;
  font-family:'Inter', sans-serif;
}

h1, p { color: #fff; }

:root {
  /* override the default percentage */
  --tube-percentage: 70%;
  /* override the default title */
  --tube-title: "CSS";
  /* override the default color */
  --tube-color: #9198e5;
}

.tube {
  position: relative;
  height: 200px;
  width: 50px;
  border: 3px solid #272822;
  border-radius: 0 0 50rem 50rem;
  /* background-color: #272822; */
  top: -100px;
  /* opacity: 0.5; */
}

.tube::after {
  content: "";
  position: absolute;
  left: -13px;
  top: -15px;
  width: calc(100% + 20px);
  height: 8px;
  border-radius: 50rem;
  border: 3px solid #272822;
  /* background-color: #272822; */
}

.tube .body {
  position: absolute;
  border-radius: inherit;
  height: 100%;
  width: 100%;
  bottom: 0;
  overflow: hidden;
  /* opacity: 0.5; */
  z-index: 5;
}

.tube .shine {
  position: absolute;
  left: 10%;
  top: 0;
  width: 10%;
  height: 100%;
  z-index: 90;
  opacity: 0.2;
}

.tube .shine::before,
.tube .shine::after {
  content: "";
  position: absolute;
  background-color: #fff;
  border-radius: 50rem;
  top: 10%;
  height: 40%;
  width: 100%;
}

.tube .shine::after {
  height: 15%;
  top: 60%;
  bottom: 0;
}

@keyframes liquid {
  0% {
    transform: translateX(-50%) rotate(0deg);
  }
  100% {
    transform: translateX(-50%) rotate(360deg);
  }
}

.tube .liquid {
  position: absolute;
  height: 80%;
  width: 100%;
  bottom: 0;
}

.tube .liquid .percentage {
  position: absolute;
  height: var(--tube-percentage);
  width: 100%;
  bottom: 0;
  left: 0;
  z-index: 80;
  transition: 1s;
}

.tube .liquid .percentage::after,
.tube .liquid .percentage::before {
  position: absolute;
  content: "";
  width: 200px;
  height: 200px;
  border-radius: 75px;
  animation: liquid 4s infinite linear;
  transform: translateX(-50%);
 ...