js+css实现可拖拽质感数值旋钮调节效果代码

代码语言:html

所属分类:拖放

代码描述:js+css实现可拖拽质感数值旋钮调节效果代码

代码标签: js css 拖拽 质感 数值 旋钮 调节

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

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

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


  
<style>
@import url("https://fonts.googleapis.com/css2?family=Sora:wght@200;400;500&display=swap");
@layer properties {
  @property --value {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
  }
}
:root {
  --bg-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 600 600' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  --bg-color: hsl(229deg 29% 10%);
  --glow-color-opacity: 0;
  --glow-color: oklch(82.6% 0.185 76.24 / calc(var(--glow-color-opacity) * 1%));
}

@supports (color: color(display-p3 0 0 0)) {
  :root {
    --glow-color-opacity: 100;
    --glow-color-luminance: 10;
    --glow-color-p3: 0.99 0.71 0.18;
    --glow-color: color-mix(
      in lch,
      color(
        display-p3 var(--glow-color-p3) / calc(var(--glow-color-opacity) * 1%)
      ),
      white calc(var(--glow-color-luminance) * 1%)
    );
  }
}
*,
*:before,
*:after {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body {
  background-color: var(--bg-color);
  background-image: radial-gradient(ellipse at 50% 0%, white, rgba(0, 0, 0, 0.4)), repeating-radial-gradient(circle at center, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6) 14px, rgba(255, 255, 255, 0) 18px, rgba(255, 255, 255, 0.3) 18px, rgba(0, 0, 0, 0.6) 21px);
  font-family: "Sora", sans-serif;
  background-blend-mode: soft-light;
  background-size: 100% 100%;
  display: grid;
  place-items: center;
}
body:before {
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, transparent 50%, rgba(7, 8, 24, 0.6));
}
body:after {
  position: absolute;
  display: block;
  content: "";
  width: 100%;
  height: 100%;
  background: var(--bg-grain) repeat top left/300px;
  z-index: 10;
  opacity: 0.15;
  mix-blend-mode: color-dodge;
  pointer-events: none;
}

main {
  width: 500px;
  max-width: 100%;
  aspect-ratio: 1/1;
  border-radius: 1000000px;
  background: radial-gradient(ellipse at 50% 0%, #1f1a23, #0a090c);
  position: relative;
  display: block;
  align-items: center;
  justify-content: center;
}
main *, main *:before, main *:after {
  will-change: transform, filter, background;
}
main:after {
  content: "";
  position: absolute;
  width: 80%;
  height: 80%;
  background: #131320;
  display: block;
  border-radius: inherit;
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.8), inset 0 -4px 6px -1px rgba(255, 255, 255, 0.1);
  z-index: inherit;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}
main:before {
  content: "";
  display: block;
  position: absolute;
  width: 60%;
  aspect-ratio: 1/1;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), inset 0 -1px 2px rgba(0, 0, 0, 0.3), 0 0 20px 2px rgba(0, 0, 0, 0.2);
  z-index: 11;
  border-radius: 100000px;
  pointer-events: none;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}
main .circle-line {
  --glow-color-opacity: calc(var(--value) / 2);
  --glow-color-luminance: 70;
  --glow-color: color-mix(
    in lch,
    color(display-p3 0.99 0.71 0.18 / calc(var(--glow-color-opacity) * 1%)),
    white calc(var(--glow-color-luminance) * 1%)
  );
  position: absolute;
  width: 80.5%;
  height: 80.5%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  background: conic-gradient(from 0.5turn, transparent calc(100% - var(--value) * 1%), var(--glow-color) calc(100% - calc(var(--value) * 1%)));
  -webkit-mask-image: conic-gradient(from 0.5turn, black, black, transparent);
          mask-image: conic-gradient(from 0.5turn, black, black, transparent);
  border-radius: 100000px;
  transform: rotateY(180deg);
}
main .outer-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  transform: rotate(calc(var(--value) * 3.6 * 1deg));
}
main .outer-glow:after {
  content: "";
  display: block;
  position: absolute;
  width: 20px;
  height: 50px;
  background: var(--glow-color);
  border-radius: 100%;
  z-index: 0;
  transform: translate(240px, 500px);
  filter: blur(20px);
  mix-blend-mode: plus-lighter;
  opacity: calc(var(--value) / 100);
}
main > div.inner {
  width: 300px;
  aspect-ratio: 1/1;
  position: absolute;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
main > div.inner .halo-outer {
  position: absolute;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 16px black, inset 0 0 8px rgba(0, 0, 0, 0.8), inset 0 0 6px rgba(0, 0, 0, 0.6);
  border-radius: 100000px;
  transform: scale(1.66) rotateY(180deg);
  z-index: 5;
}
main > div.inner .halo-outer:before {
  --glow-color-opacity: calc(var(--value) / 2);
  --glow-color-luminance: 10;
  --glow-color: color-mix(
    in lch,
    color(
      display-p3 va.........完整代码请登录后点击上方下载按钮下载查看

网友评论0