因此,当页面加载时,我希望我的set容器能够反弹。例如,CSS应该是......
.bouncein {
animation-name: bounceIn;
animation-duration: 1s;
animation-delay: 0.5s;`
}
但我需要知道关键帧。
因此,当页面加载时,我的div与类弹跳将会反弹。
答案 0 :(得分:1)
你可以这样做:
.bouncein {
animation-name: bounceIn;
animation-duration: 1s;
animation-delay: 0.5s;
width: 100px;
height: 100px;
background-color: red;
}
@keyframes bounceIn {
0% {
transform:translateY(-100%);
opacity: 0;
}
15% {
transform:translateY(0);
padding-bottom: 5px;
}
30% {
transform:translateY(-50%);
}
40% {
transform:translateY(0%);
padding-bottom: 6px;
}
50% {
transform:translateY(-30%);
}
}
70% {
transform:translateY(0%);
padding-bottom: 7px;
}
80% {
transform:translateY(-15%);
}
90% {
transform:translateY(0%);
padding-bottom: 8px;
}
95% {
transform:translateY(-7%);
}
97% {
transform:translateY(0%);
padding-bottom: 9px;
}
99% {
transform:translateY(-3%);
}
100% {
transform:translateY(0);
padding-bottom: 9px;
opacity: 1;
}
}
<div class="bouncein"></div>
答案 1 :(得分:1)
检查这个
也适用于更多css动画
检查此https://daneden.github.io/animate.css/
延迟你可以使用&#34;动画延迟&#34; http://www.w3schools.com/cssref/css3_pr_animation-delay.asp
喜欢:
@keyframes bounceIn {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
opacity: 1;
}
40% {
transform: translateY(-30px);
}
60% {
transform: translateY(-15px);
}
}
body {
background: black;
}
.arrow {
position: fixed;
bottom: 0;
left: 50%;
margin-left:-20px;
width: 40px;
height: 40px;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RUR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Ii8+DQo8L3N2Zz4=);
background-size: contain;
opacity: 0;
}
.bounce {
animation: bounceIn 2s infinite 2s;
}
&#13;
<div class="arrow bounce"></div>
&#13;
答案 2 :(得分:-1)
Arkej的答案显示,但我认为使用Animate.CSS更容易也更好。