I am trying to chain together 2 CSS animations, see pen: http://codepen.io/jdesilvio/pen/pjwvyO
I have followed the syntax provided in other answers to similar questions, but they don't seem to work correctly:
animation-name: falling, laydown;
animation-duration: 2000ms, 1000ms;
animation-timing-function: ease-in, ease-out;
animation-iteration-count: 1, 1;
It is playing the second animation, then the first and finally the second one again. How can I get it to play the first, then second?
Here is the full code:
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
@keyframes falling {
0% {
transform: translate3d(0, -400px, 0);
}
100% {
transform:
translate3d(0, 40%, 0)
rotateX(30deg)
rotateY(0deg)
rotateZ(60deg);
}
}
@keyframes laydown {
0% {
transform:
translate3d(0, 40%, 0)
rotateX(30deg)
rotateY(0deg)
rotateZ(60deg);
}
100% {
transform:
translate3d(0, 40%, 0)
rotateX(70deg)
rotateY(0deg)
rotateZ(80deg);
}
}
#falling-card-parent {
height: 150px;
width: 100px;
margin: auto;
perspective: 1000px;
}
#falling-card {
height: 150px;
width: 100px;
background-color: black;
margin: auto;
transform:
translate3d(0, 40%, 0)
rotateX(70deg)
rotateY(0deg)
rotateZ(80deg);
animation-name:
falling, laydown;
animation-duration:
2000ms, 1000ms;
animation-timing-function:
ease-in, ease-out;
animation-iteration-count:
1, 1;
}
</style>
<html>
<body>
<div id="falling-card-parent">
<div id="falling-card"></div>
</div>
</body>
</html>