js滑块拖动改变图片hue-rotate效果代码

代码语言:html

所属分类:拖放

代码描述:js滑块拖动改变图片hue-rotate效果代码

代码标签: js 滑块 拖动 改变 图片 hue rotate

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

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

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

  <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Comfortaa:300,700|Bungee+Shade|Josefin+Sans:400&display=swap"/>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Gochi+Hand&display=swap"/>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap"/>
  
  
  
<style>
@layer reset, base, layout, filter;

@layer filter {
  :root {
    --hue-rotate: 45deg;
  }
  figure {
    filter: hue-rotate(var(--hue-rotate));
  }
}

@layer layout {
  
  .filter {
    display: grid;
    gap: 5px;
  }
  h1 {
    width:min(100% - 2rem, 360px);
    text-transform: uppercase;
    font-weight: 100;
    line-height: 0.9em;
    font-family: 'Comfortaa';
    margin-inline: auto;
    

    .filter__name {
      font-family: 'Bungee Shade';
      font-weight: 800;
      font-size: 1em;
    }
  }

  .filter__wrapper {
    display: grid;
    width: min(100% - 2rem, 360px);
    background: #120f11;
    margin: 0 auto;
    place-content: center;
    justify-content: center;
    padding: 20px;

    & figure {
      width: min(100%, 320px);
      aspect-ratio: 1;
      display: grid;
      margin-bottom: 20px;
    }

    & img {
      display: block;
      width: 100%;
      aspect-ratio: 1;
      -o-object-fit: cover;
         object-fit: cover;
      -o-object-position: center;
         object-position: center;
      place-self: center;
    }
  }

  .filter__control {
    padding: 8px 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    gap: 10px;

    & label {
      border-left: 2px #272123 double;
      padding-left: 12px;
      white-space: nowrap;
    order: 2;
    }
  }

  .filter__control,
  .filter__info {
    border-top: 1px #272123 dashed;
  }
  
  .filt.........完整代码请登录后点击上方下载按钮下载查看

网友评论0