bootstrap+svg实现图片过滤调节动画效果代码

代码语言:html

所属分类:其他

代码描述:bootstrap+svg实现图片过滤调节动画效果代码

代码标签: bootstrap svg 图片 过滤 调节 动画

下面为部分代码预览,完整代码请点击下载或在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/bootstrap-icons.1.5.css">
  
<style>
body {
  padding: 0;
  margin: 0;
  background: #f5f5f5;
  font-family: "Plus Jakarta Sans", sans-serif;
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: 700;
}

.container {
  display: flex;
  justify-content: center;
  gap: 20px;
}

input[type=range] {
  width:100%
}

.card {
  margin-top: 24px;
  margin-bottom: 24px;
  border-radius: 24px;
  padding: 24px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
    rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
  border: none;
}

.card h5 {
  margin-bottom: 24px;
}

.btn {
  border-radius: 24px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px,
    rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
  margin: 4px;
  padding:8px 24px
}

.btn .bi {
  margin-right:6px
}


#toggleButtonShow {
  display:none
}

#container-row {
  background-color: #ddc;
  border: 50px solid #000;
  border-bottom-color: #333333;
  border-left-color: #252525;
  border-right-color: #252525;
  border-top-color: #000000;
  box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px,
    rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
  box-sizing: border-box;
  display: inline-block;
  margin-top: 24px;
  padding: 0;
  min-width: 1100px;
  transform: scale(0.8);
  transform-origin: top center;
}

.imgContainer {
  width: 500px;
  height: 500px;
  overflow: hidden;
  position: relative;
  float: left;
  transition: filter 0.5s ease;
}

.imgContainer:nth-child(2) {
  width: 500px;
  height: 500px;
  overflow: hidden;
  position: relative;
}

.image {
  width: 1920px;
  height: 2880px;
  object-fit: cover;
  object-position: top;
  margin-top: -290px;
  margin-left: -340px;
  filter: hue-rotate(0deg) contrast(160%) brightness(130%) sepia(30%);
}

.hair,
.mouth,
.eyelids,
.face {
  width: 1920px;
  height: 2880px;
  mix-blend-mode: color;
}

.bg {
  width: 1920px;
  height: 2880px;
  mix-blend-mode: normal;
}

.imgContainer:nth-child(1) .bg path {
  fill: #048ebc;
}

.imgContainer:nth-child(1) .hair path {
  fill: #eddd66;
}

.imgContainer:nth-child(1) .face path {
  fill: #754347;
}

.imgContainer:nth-child(1) .eyelids path {
  fill: #048ebc;
}
.imgContainer:nth-child(1) .mouth path {
  fill: #d22122;
}

.imgContainer:nth-child(2) .bg path {
  fill: #fc602f;
}

.imgContainer:nth-child(2) .hair path {
  fill: #fda660;
}

.imgContainer:nth-child(2) .face path {
  fill: #f9aecc;
}

.imgContainer:nth-child(2) .eyelids path {
  fill: #9274ba;
}
.imgContainer:nth-child(2) .mouth path {
  fill: #d22122;
}

.imgContainer:nth-child(3) .bg path {
  fill: #f83637;
}

.imgContainer:nth-child(3) .hair path {
  fill: #fad333;
}

.imgContainer:nth-child(3) .face path {
  fill: #ffffff;
}

.imgContainer:nth-child(3) .eyelids path {
  fill: #d22122;
}
.imgContainer:nth-child(3) .mouth path {
  fill: #d22122;
}

.imgContainer:nth-child(4) .bg path {
  fill: #00bc43;
}

.imgContainer:nth-child(4) .hair path {
  fill: #fd45e7;
}

.imgContainer:nth-child(4) .face path {
  fill: #d8b8fc;
}

.imgContainer:nth-child(4) .eyelids path {
  fill: #8aceac;
}
.imgContainer:nth-child(4) .mouth path {
  fill: #9d01fb;
}

.face {
  filter: hue-rotate(0deg);
}

.mouth {
  filter: hue-rotate(0deg);
}

.eyelids {
  filter: hue-rotate(0deg);
}

svg {
  position: absolute;
  top: 0;
  left: 0;
  margin-top: -290px;
  margin-left: -340px;
}

.hidden {
  display: none;
}

.credits {
  position:fixed;
  display:block;
  text-align:center;
  bottom: 0;
  max-width:100%;
  background: #f5f5f5;
  padding:16px;
  width:100%
}







@media only screen and (max-width: 600px) {
#container-row{
    transform:scale(0.3)
  };
  .card {
    margin-top:-700px
  }
}
@media only screen and (min-width: 600px) {
#container-row {
    transform:scale(0.5)
  };
  .card {
    margin-top:-500px
  }
}
@media only screen and (min-width: 768px) {
#container-row{
    transform:scale(0.6)
  };
  .card {
    margin-top:-400px
  }
}
@media only screen and (min-width: 992px) {
#container-row{
    transform:scale(0.6)
  };
  .card {
    margin-top:0px
  }
}
@media only scr.........完整代码请登录后点击上方下载按钮下载查看

网友评论0