js+css使用filter滑竿调节照片亮度对比度模糊灰色等效果代码

代码语言:html

所属分类:其他

代码描述:js+css使用filter滑竿调节照片亮度对比度模糊灰色等效果代码

代码标签: js css filter 滑竿 调节 照片 亮度 对比度 模糊 灰色

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

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

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

  <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.5.3.0.css">
  <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/aos.2.3.1.css">
<style>
@import url("https://fonts.googleapis.com/css2?family=Open+Sans&family=Raleway&family=Poppins&display=swap");


body, html, button {
  height: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
	background-color: gainsboro;
	font-family: "Poppins", sans-serif;
}

figure img {
  text-align: center;
	width: 40vw;
	height: 80vh;
	object-fit: cover;
	background: white;
	padding: 10px 10px 35px;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
	transition: all 0.15s linear;
	z-index: 0;
	position: relative;
	transform: rotate(4deg);
}
	
img {
  max-width: 60%;
  max-height: 80vh;
  margin: 0 auto;
  display: block;
}

#apply-blend-mode {
  margin-top: 10px;
}
</style>


</head>

<body>
  <figure>
	<img id="filter-image" src="//repo.bfw.wiki/bfwrepo/image/5d65ea7d8bc8b.png" alt="3D rendered image of a group of green glass objects rising up out of a hole in a green table. " title="Photo by Allison Saeng for Unsplash. ">
</figure>

<div class="control">
<!--// My additional code //-->
	<p><input type="range" class="inp" min="0" max="200" id="brightness" value="100" />
		<label><span class="info input-group-text"> Brightness: <span id="brightness-value">100%</span></span></label>	
	</p>
  
	<p><input type="range" class="inp" min="0" max="200" id="contrast" value="100" />
		<label><span class="info input-group-text"> Contrast: <span id="contrast-value">100%</span></span></label>	
	</p>
  
	<p><input type="range" class="inp" min="0" max="100" id="opacity" value="100" />
		<label><span class="info input-group-text"> Opacity: <span id="opacity-value">100%</span></span></label>
	</p>
	
	<p><input type="range" class="inp" min="0" max="100" id="grayscale" value="0" />
		<label><span class="info input-group-text"> Grayscale: <span id="grayscale-value">0%</span></span></label>
	</p>
  
	<p><input type="range" class="inp" min="0" max="100" id="sepia" value="0" />
		<label><span class="info input-group-text"> Sepia: <span id="sepia-value">0%</span></span></label>
	</p>
	
	<p><input type="range" class="inp" min="0" max="10" id="blur" value="0" />
		<label><span class="info input-group-text"> Blur: <span id="blur-value">0px</span></span></label>
	</p>

	<div class="btn-group" role="group" aria-label="buttons">
		<button class="btn btn-secondary disabled" id="random-filter" disabled>Random</button> 
		<button class="btn btn-primary" id="reset-filter">Reset</button>
	</div>
</div>
  
      <script>

/*
// Template ${}
const ${} = document.getElementById('${}'.........完整代码请登录后点击上方下载按钮下载查看

网友评论0