【发布时间】:2019-07-25 12:01:54
【问题描述】:
我想让我的StyledModalWrapper 为scale() 设置动画。
我的 StyledComponent 具有以下属性:
top: 50%;
left: 50%;
max-width: ${(props:IModal) => props.width};
min-height: auto;
transform: translate(-50%, -50%);
animation: ${(props:IModal) => props.closing ? popOut : popIn} .3s linear;
动画:
0% {
transform: scale(0);
}
80% {
transform: scale(1.25);
}
100% {
transform: scale(1);
}
在这种情况下,盒子可以完美缩放,只是定位不是。
我尝试添加
0% {
transform: scale(0) translate(100%, 100%);
}
80% {
transform: scale(1.25) translate(25%, 25%);
}
100% {
transform: scale(1) translate(50%, 50%);
}
在这种情况下,它会以曲线滑动。
框的中心应始终位于父框的中间。
父级具有width/height 或100vw/100vh。
【问题讨论】:
标签: css animation styled-components