使用不透明度和过渡动画混合模式
Animate Blend Mode with opacity and transition
我正在寻找一种方法来改变 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>
混合模式只有在有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>
我正在寻找一种方法来改变 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>
混合模式只有在有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>