js实现hwb颜色选择器拖拽生成css代码

代码语言:html

所属分类:选择器

代码描述:js实现hwb颜色选择器拖拽生成css代码

代码标签: js hwb 颜色 选择器 拖拽 生成 css 代码

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

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

<head>

  <meta charset="UTF-8">


  
  
<style>
* {
  box-sizing: border-box;
}

@keyframes moveBg {
  100% {
    background-position: 120px 120px;
  }
}
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.hwb-panel {
  width: 100vw;
  height: 100vh;
  background: rgba(51, 51, 179, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.15) 50%, transparent 0), linear-gradient(rgba(0, 0, 0, 0.12) 50%, transparent 0);
  background-size: 120px 120px;
  background-position: 0 0;
  transition: 0.36s cubic-bezier(0.19, 1, 0.22, 1);
  animation: moveBg 9.66s linear forwards infinite;
}

.hwb-panel-inner {
  margin: 20px;
  padding: 20px;
  box-shadow: 0 0 0px 3px rgba(51, 51, 179, 0.95) inset, 0 0 6px 3px;
  border-radius: 8px;
  background-color: hwb(0deg 100% 0%/75%);
  display: flex;
  flex-wrap: wrap;
  max-width: 660px;
  justify-content: space-between;
}

.editor-hue {
  width: 300px;
}

.editor-inputs {
  width: 300px;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 20px;
}
.editor-inputs > div {
  margin: 2px 0;
}
.editor-inputs p {
  font-size: 18px;
  margin: 0;
  text-align: center;
}

h2 {
  margin: 0 0 20px 0;
  text-align: center;
  font-size: 26px;
  color: #424242;
  width: 100%;
}

.sphere {
  display: none;
}

input {
  width: 100%;
  border: none;
  margin-bottom: 10px;
  box-shadow: 1px 1px 4px -1px #767676;
  height: 30px;
  border-radius: 3px;
  padding: 4px 6px;
}

.wheel-wrapper {
  position: relative;
}

.wheel {
  position: relative;
  transform: rotate(90deg);
  z-index: 1;
}
.wheel img {
  display: block;
  pointer-events: none;
  user-select: none;
}

.wheel-selector {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  top: calc(50% - 30px);
  left: calc(50% - 30px);
  transform-origin: 150px;
  z-index: 1;
  box-shadow: 0 0 25px 5px inset rgba(0, 0, 0, 0.75);
}

.hue {
  position: absolute;
  background: white;
  top: calc(50% - 92px);
  left: calc(50% - 92px);
  b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0