2

我正在寻找一种方法来改变background-color-blend-mode像 Photoshop 这样的不透明度。我的目标是为混合模式的不透明度设置动画以使其消失。有任何想法吗 ?

#img-esadvalence {
  background-image: url(http://leodurand.fr/works/planesad/esad1.jpg);
  background-color: #e12a1c;
  background-blend-mode: screen;
}

.all-img-menu {
    background-size: contain;
    background-position: center; 
    width: 110%;
    padding-bottom: 40.75vh;
    display: block;
    top: 50%;
    -ms-transform: translate(0%,-50%);
    -webkit-transform: translate(0%,-50%); 
    transform: translate(0%,-50%);
    position: absolute;
    transition: all 0.6s ease;
}
<div id="img-esadvalence" class="all-img-menu"></div>

4

1 回答 1

8

混合模式仅在有 2 个背景时有效。要逐渐取消混合模式,您可以设置动画(过渡)到透明背景颜色。

Demo(悬停图片查看效果):

#img-esadvalence {
  background-image: url(https://placeimg.com/640/480/animals);
  background-color: #e12a1c;
  background-blend-mode: screen;
  transition: background-color 1s;
}


#img-esadvalence:hover {
  background-color: transparent;
}

.all-img-menu {
    background-size: contain;
    background-position: center; 
    width: 110%;
    padding-bottom: 40.75vh;
    display: block;
    top: 50%;
    -ms-transform: translate(0%,-50%);
    -webkit-transform: translate(0%,-50%); 
    transform: translate(0%,-50%);
    position: absolute;
    transition: all 0.6s ease;
}
<div id="img-esadvalence" class="all-img-menu"></div>

于 2017-08-04T09:12:52.317 回答