js实现图片简单过滤调节效果代码

代码语言:html

所属分类:布局界面

代码描述:js实现图片简单过滤调节效果代码,图片反色、图片饱和度调节、图片模糊、对比度等

代码标签: 简单 过滤 调节 效果

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

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

<head>

    <meta charset="UTF-8">





    <style>
        main {
            display: grid;
            grid-template-columns: 120px 420px;
            justify-items: center;
            font-family: arial;
        }
        #workarea {
            display: grid;
            grid-template-rows: auto auto;
            background-position: center;
            background-size: cover;
        }
        #image-container {
            display: grid;
            width: 400px;
            height: 400px;
            padding: 5px;
            outline: 1px solid #00000040;
        }
        #change-image {
            position: absolute;
            font-size: 2em;
            color: black;
            background-color: #ffffff20;
            border-radius: 5px;
            text-shadow: white 0px 0px 2px;
            top: 5%;
            justify-self: center;
            cursor: pointer;
        }
        #image-container:hover #change-image {
            background-color: #ffffffA0;
        }
        #image-filters {
            position: relative;
            display: grid;
            padding: 1%;
            box-shadow: 1px 1px 3px #00000060;
            outline: 0px solid #00000040;
            transition: filter 1s ease;
        }
        #image {
            background-position: center;
            background-size: cover;
            background-repeat: no-repeat;
            transition: background-image .5s ease;
        }
        #container {
            display: grid;
            margin: 5px;
            grid-auto-flow: row;
            justify-content: space-between;
        }
        #container .range {
            text-align: center;
            width: 110px;
            margin: 5px;
            outline: 1px solid #00000040;
        }
        #container .range input {
            width: 100px;
        }
        #container .range:hover {
            outline: 1px solid #000000a0;
        }
    </style>




</head>

<body>
    <main>
        <div id="container">
            <div class="range">
                <input value="0" id="hue-rotate" type="range" min="-90" max="90" step="1" /><button>Hue</button>
            </div>
            <div class="range">
                <input value="0" id="invert" type="range" min="0" max="100" step="1" /><button>Invert</button>
            </div>
            <div class="range">
                <input value="100" id="saturate" type="range" min="0" max="1000" step="1" /><button>Saturation</button>
            </div>
            <div class="range">
                <input value="100" id="contrast" type="range" min="0" max="200" step="1" /><button>Contrast</button>
            </div>
            <div class="range">
                <input value="0" id="blur" type="range" min="0" max="10" step=".05" /><button>Blur</button>
            </div>
        </div>
        <div id="workarea">
            <div id="image-container">
                <div id="image-filters"
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0