【发布时间】:2020-06-09 10:44:11
【问题描述】:
<style>
@keyframes bounceIn {
from,
20%,
40%,
60%,
80%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
-webkit-transform: scale3d(0.3, 0.3, 0.3);
transform: scale3d(0.3, 0.3, 0.3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(0.9, 0.9, 0.9);
transform: scale3d(0.9, 0.9, 0.9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(0.97, 0.97, 0.97);
transform: scale3d(0.97, 0.97, 0.97);
}
to {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
.card {
height: 400px;
width: 100%;
max-width: 360px;
margin: 50px 10px 0px 10px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
animation: bounceIn 0.85s linear forwards;
}
我使用来自 animated.css 的代码为我的卡片制作动画。我有多张卡片,我想一张一张地制作动画。第一张卡延迟为 0.85s,第二张为 0.9s,第三张为 0.95s,以此类推。有没有办法在 CSS 中做到这一点,而无需创建大量新类,如 .card_1、.card_2 等?
【问题讨论】:
标签: html css css-animations keyframe