gsap实现密码框隐藏显示密码眼睛跟随鼠标交互效果代码

代码语言:html

所属分类:表单美化

代码描述:gsap实现密码框隐藏显示密码眼睛跟随鼠标交互效果代码

代码标签: 隐藏 显示 密码 眼睛 跟随 鼠标 交互 效果

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


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

<head>

  <meta charset="UTF-8">
  


  <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Poppins:wght@400;500&amp;display=swap'>
  
<style>
.password-field {
  --c-text: #5A5A64;
  --c-text-light: #A1A1B6;
  --c-text-selection: #09ABC3;
  --c-background: #fff;
  --c-background-selection: rgba(9, 171, 195, 0.15);
  --c-border: #E2E2ED;
  --c-border-hover: #D0D0DB;
  --c-border-active: #09ABC3;
  --c-shadow: rgba(41, 41, 86, 0.06);
  --c-shadow-active: rgba(9, 171, 195, 0.25);
  --eye-background: 0;
  --eye-offset: 3px;
  --eye-wrapper-y: 0;
  --eye-y: 0;
  --eye-x: 0;
  --eye-s: 1;
  width: 220px;
  position: relative;
  border-radius: 7px;
  background: var(--c-background);
  box-shadow: inset 0 0 0 1px var(--border, var(--c-border)), 0px 1px 3px var(--shadow, var(--c-shadow));
  transition: box-shadow 0.25s;
}
.password-field:hover {
  --border: var(--c-border-hover);
  --eye-duration: .05s;
}
.password-field:focus-within {
  --border: var(--c-border-active);
  --shadow: var(--c-shadow-active);
}
.password-field input,
.password-field button {
  -webkit-appearance: none;
  outline: none;
  background: none;
  border: none;
  margin: 0;
}
.password-field input {
  display: block;
  font-family: inherit;
  font-size: 16px;
  line-height: 21px;
  height: 45px;
  color: var(--c-text);
  padding: 12px 41px 12px 16px;
  transform: translateY(var(--y, var(--default-y, 0))) translateZ(0);
  opacity: var(--o, var(--default-o, 1));
  pointer-events: var(--pe, var(--default-pe, auto));
  transition: filter 0.35s, transform 0.4s, opacity 0.25s;
}
.password-field input::-moz-placeholder {
  color: var(--c-text-light);
  -moz-transition: color 0.25s;
  transition: color 0.25s;
}
.password-field input:-ms-input-placeholder {
  color: var(--c-text-light);
  -ms-transition: color 0.25s;
  transition: color 0.25s;
}
.password-field input::placeholder {
  color: var(--c-text-light);
  transition: color 0.25s;
}
.password-field input::-moz-selection {
  color: var(--c-text-selection);
  background: var(--c-background-selection);
}
.password-field input::selection {
  color: var(--c-text-selection);
  background: var(--c-background-selection);
}
.password-field input:focus::-moz-placeholder, .password-field input:hover::-moz-placeholder {
  color: var(--c-text);
}
.password-field input:focus:-ms-input-placeholder, .password-field input:hover:-ms-input-placeholder {
  color: var(--c-text);
}
.password-field input:focus::placeholder, .password-field input:hover::placeholder {
  color: var(--c-text);
}
.password-field input:not(.clear) {
  width: 100%;
}
.password-field input.clear {
  --y: var(--clear-y, 12px);
  --o: var(--clear-o, 0);
  --pe: var(--clear-pe, none);
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
}
.password-field button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  padding: 11px;
  position: absolute;
  z-index: 1;
  right: 0;
  top: 0;
  transform: scale(var(--s, 1));
  color: var(--c-text-light);
  transition: color 0.25s, transform 0.15s;
}
.password-field button:hover {
  color: var(--c-text);
}
.password-field button:active {
  --s: .95;
}
.password-field button svg {
  display: block;
  width: 23px;
  height: 23px;
  pointer-events: none;
}
.password-field button svg .top,
.password-field button svg .bottom,
.password-field button svg .lashes {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5px;
  stroke-linecap: round;
}
.password-field button svg .lashes {
  stroke-dasharray: 3px;
  stroke-dashoffset: var(--eye-offset);
}
.password-field button svg .top {
  fill: var(--c-background);
  fill-opacity: var(--eye-background);
}
.password-field button svg .eye {
  fill: currentColor;
  transform-origin: 10.5px 13.5px;
  transform: translate(var(--eye-x), var(--eye-y)) scale(var(--eye-s)) translateZ(0);
  transition: transform var(--eye-duration, 0.3s);
}
.password-field.show {
  --default-y: -12px;
  --default-o: 0;
  --default-pe: none;
  --clea.........完整代码请登录后点击上方下载按钮下载查看

网友评论0