进入视口时,我正在尝试运行转场。我想要的牌只是不透明的。我在div中有一个代理元素,应用了背景滤镜来应用“磨砂玻璃”的外观。当父对象有任何类型的不透明度变化时,滤镜根本不会应用,并导致动画笨拙。以下是上下文的CSS:
.card {
width: 100%;
position: relative;
min-height: 320px;
border-radius: 12px;
overflow: hidden;
padding: 32px 24px;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
text-align: center;
display: flex;
align-items: center;
justify-content: center;
max-width: 45rem;
margin: 8px 0;
transition: all 0.4s ease;
.backdrop {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
border-radius: 12px;
backdrop-filter: blur(32px) brightness(115%);
background-color: rgba(255, 255, 255, 0.16);
}
}我也尝试过将过渡应用于子对象,也尝试将以下内容应用于父对象和背景对象:
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
-webkit-perspective: 1000;发布于 2020-12-15 01:26:59
您可以使用@keyframes制作动画,如下所示:
.card {
width: 100%;
position: relative;
min-height: 320px;
border-radius: 12px;
overflow: hidden;
padding: 32px 24px;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
text-align: center;
display: flex;
align-items: center;
justify-content: center;
max-width: 45rem;
margin: 8px 0;
animation: fadein 3s;
.backdrop {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
border-radius: 12px;
backdrop-filter: blur(32px) brightness(115%);
background-color: rgba(255, 255, 255, 0.16);
}
}
@keyframes fadein {
from{opacity: 0;}
50%{opacity: 0.5} /* Ignored */
to{opacity: 1;}您可以将其更改为可能处于悬停状态以更改它。
https://stackoverflow.com/questions/65293165
复制相似问题