css+js实现中性立体液态彩色温度滑竿效果代码

代码语言:html

所属分类:拖放

代码描述:css+js实现中性立体液态彩色温度滑竿效果代码

代码标签: css js 中性 立体 液态 彩色 温度 滑竿

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


  
  
<style>
@charset "UTF-8";
@supports (background: paint(foo)) {
  @property --progress {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 0%;
  }
  @property --x {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 0%;
  }
  @property --y {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 0%;
  }
}
:root {
  --c1: #00adff;
  --c2: #39d469;
  --c3: #ffeb00;
  --c4: #ff8100;
  --c5: #b50f0f;
  --surface: #fffeff;
  --on-surface: #636571;
  --outline: #000001;
  --background: #112;
  --v: 1;
}

.thermostat {
  height: 24vmin;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1vmin;
  position: relative;
  place-items: center;
}

.liquid {
  position: absolute;
  inset: 0;
  border-radius: 10vmin;
  overflow: hidden;
  isolation: isolate;
}
.liquid .bg {
  position: absolute;
  inset: 0;
}
.liquid .bg:before, .liquid .bg:after {
  content: "";
  position: absolute;
  inset: 0;
  --gp: calc(100% - var(--progress));
  background: linear-gradient(to bottom, var(--c5) calc(5% - var(--gp)), var(--c4) calc(25% - var(--gp)), var(--c3) calc(50% - var(--gp)), var(--c2) calc(75% - var(--gp)), var(--c1) calc(100% - var(--gp)));
  transform: translateY(calc(100% - var(--progress)));
  -webkit-animation: wave 1s linear infinite;
          animation: wave 1s linear infinite;
  transition: all 0.3s linear;
  filter: saturate(0.65);
}
.liquid .bg:after {
  transform: scaleX(-1) translateY(calc(100% - var(--progress)));
  opacity: 0;
  --o: 0.6;
  -webkit-animation-delay: 0.55s;
          animation-delay: 0.55s;
}

@-webkit-keyframes wave {
  from {
    opacity: var(--o, 1);
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 27.83%, 7.14% 28.61%, 14.29% 28.98%, 21.43% 28.9%, 28.57% 28.4%, 35.71% 27.49%, 42.86% 26.22%, 50% 24.65%, 57.14% 22.86%, 64.29% 20.95%, 71.43% 19%, 78.57% 17.12%, 85.71% 15.4%, 92.86% 13.92%, 100% 12.77%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 27.83%, 7.14% 28.61%, 14.29% 28.98%, 21.43% 28.9%, 28.57% 28.4%, 35.71% 27.49%, 42.86% 26.22%, 50% 24.65%, 57.14% 22.86%, 64.29% 20.95%, 71.43% 19%, 78.57% 17.12%, 85.71% 15.4%, 92.86% 13.92%, 100% 12.77%);
  }
  25% {
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 17.77%, 7.14% 16.02%, 14.29% 14%, 21.43% 11.82%, 28.57% 9.58%, 35.71% 7.4%, 42.86% 5.38%, 50% 3.63%, 57.14% 2.23%, 64.29% 1.26%, 71.43% 0.76%, 78.57% 0.76%, 85.71% 1.26%, 92.86% 2.23%, 100% 3.63%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 17.77%, 7.14% 16.02%, 14.29% 14%, 21.43% 11.82%, 28.57% 9.58%, 35.71% 7.4%, 42.86% 5.38%, 50% 3.63%, 57.14% 2.23%, 64.29% 1.26%, 71.43% 0.76%, 78.57% 0.76%, 85.71% 1.26%, 92.86% 2.23%, 100% 3.63%);
  }
  50% {
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 2.21%, 7.14% 1.34%, 14.29% 0.93%, 21.43% 1.01%, 28.57% 1.58%, 35.71% 2.6%, 42.86% 4.03%, 50% 5.8%, 57.14% 7.81%, 64.29% 9.97%, 71.43% 12.16%, 78.57% 14.28%, 85.71% 16.22%, 92.86% 17.88%, 100% 19.19%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 2.21%, 7.14% 1.34%, 14.29% 0.93%, 21.43% 1.01%, 28.57% 1.58%, 35.71% 2.6%, 42.86% 4.03%, 50% 5.8%, 57.14% 7.81%, 64.29% 9.97%, 71.43% 12.16%, 78.57% 14.28%, 85.71% 16.22%, 92.86% 17.88%, 100% 19.19%);
  }
  to {
    opacity: var(--o, 1);
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 31.33%, 7.14% 32.11%, 14.29% 32.48%, 21.43% 32.4%, 28.57% 31.9%, 35.71% 30.99%, 42.86% 29.72%, 50% 28.15%, 57.14% 26.36%, 64.29% 24.45%, 71.43% 22.5%, 78.57% 20.62%, 85.71% 18.9%, 92.86% 17.42%, 100% 16.27%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 31.33%, 7.14% 32.11%, 14.29% 32.48%, 21.43% 32.4%, 28.57% 31.9%, 35.71% 30.99%, 42.86% 29.72%, 50% 28.15%, 57.14% 26.36%, 64.29% 24.45%, 71.43% 22.5%, 78.57% 20.62%, 85.71% 18.9%, 92.86% 17.42%, 100% 16.27%);
  }
}

@keyframes wave {
  from {
    opacity: var(--o, 1);
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 27.83%, 7.14% 28.61%, 14.29% 28.98%, 21.43% 28.9%, 28.57% 28.4%, 35.71% 27.49%, 42.86% 26.22%, 50% 24.65%, 57.14% 22.86%, 64.29% 20.95%, 71.43% 19%, 78.57% 17.12%, 85.71% 15.4%, 92.86% 13.92%, 100% 12.77%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 27.83%, 7.14% 28.61%, 14.29% 28.98%, 21.43% 28.9%, 28.57% 28.4%, 35.71% 27.49%, 42.86% 26.22%, 50% 24.65%, 57.14% 22.86%, 64.29% 20.95%, 71.43% 19%, 78.57% 17.12%, 85.71% 15.4%, 92.86% 13.92%, 100% 12.77%);
  }
  25% {
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 17.77%, 7.14% 16.02%, 14.29% 14%, 21.43% 11.82%, 28.57% 9.58%, 35.71% 7.4%, 42.86% 5.38%, 50% 3.63%, 57.14% 2.23%, 64.29% 1.26%, 71.43% 0.76%, 78.57% 0.76%, 85.71% 1.26%, 92.86% 2.23%, 100% 3.63%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 17.77%, 7.14% 16.02%, 14.29% 14%, 21.43% 11.82%, 28.57% 9.58%, 35.71% 7.4%, 42.86% 5.38%, 50% 3.63%, 57.14% 2.23%, 64.29% 1.26%, 71.43% 0.76%, 78.57% 0.76%, 85.71% 1.26%, 92.86% 2.23%, 100% 3.63%);
  }
  50% {
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 2.21%, 7.14% 1.34%, 14.29% 0.93%, 21.43% 1.01%, 28.57% 1.58%, 35.71% 2.6%, 42.86% 4.03%, 50% 5.8%, 57.14% 7.81%, 64.29% 9.97%, 71.43% 12.16%, 78.57% 14.28%, 85.71% 16.22%, 92.86% 17.88%, 100% 19.19%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 2.21%, 7.14% 1.34%, 14.29% 0.93%, 21.43% 1.01%, 28.57% 1.58%, 35.71% 2.6%, 42.86% 4.03%, 50% 5.8%, 57.14% 7.81%, 64.29% 9.97%, 71.43% 12.16%, 78.57% 14.28%, 85.71% 16.22%, 92.86% 17.88%, 100% 19.19%);
  }
  to {
    opacity: var(--o, 1);
    -webkit-clip-path: polygon(100% 100%, 0% 100%, 0% 31.33%, 7.14% 32.11%, 14.29% 32.48%, 21.43% 32.4%, 28.57% 31.9%, 35.71% 30.99%, 42.86% 29.72%, 50% 28.15%, 57.14% 26.36%, 64.29% 24.45%, 71.43% 22.5%, 78.57% 20.62%, 85.71% 18.9%, 92.86% 17.42%, 100% 16.27%);
            clip-path: polygon(100% 100%, 0% 100%, 0% 31.33%, 7.14% 32.11%, 14.29% 32.48%, 21.43% 32.4%, 28.57% 31.9%, 35.71% 30.99%, 42.86% 29.72%, 50% 28.15%, 57.14% 26.36%, 64.29% 24.45%, 71.43% 22.5%, 78.57% 20.62%, 85.71% 18.9%, 92.86% 17.42%, 100% 16.27%);
  }
}
@-webkit-keyframes b1 {
  from {
    --x: 50%;
    --y: 60%;
    opacity: 0;
  }
  50% {
    --x: 60%;
    --y: 45%;
    opacity: 1;
    transform: scale(1.1);
  }
  to {
    --x: 50%;
    --y: 30%;
    opacity: 0;
  }
}
@keyframes b1 {
  from {
    --x: 50%;
    --y: 60%;
    opacity: 0;
  }
  50% {
    --x: 60%;
    --y: 45%;
    opacity: 1;
    transform: scale(1.1);
  }
  to {
    --x: 50%;
    --y: 30%;
    opacity: 0;
  }
}
@-webkit-keyframes b2 {
  from {
    --x: 50%;
    --y: 80%;
    opacity: 0;
  }
  50% {
    --x: 10%;
    --y: 55%;
    opacity: 1;
    transform: scale(1.1);
  }
  to {
    --x: 60%;
    --y: 30%;
    opacity: 0;
  }
}
@keyframes b2 {
  from {
    --x: 50%;
    --y: 80%;
    opacity.........完整代码请登录后点击上方下载按钮下载查看

网友评论0