Currently, I do not understand why my animations working only in one direction.
I've put the whole example here online.
Everything works fine if I use two keyframes:
.show {
animation: showMe 0.4s;
}
.hide {
opacity: 0;
margin-top: -80px;
animation: hideMe 0.3s;
}
@keyframes hideMe {
0% {
opacity: 1;
margin-top: 20px;
}
100% {
opacity: 0;
margin-top: -80px;
}
}
@keyframes showMe {
0% {
opacity: 0;
margin-top: -80px;
}
100% {
opacity: 1;
margin-top: 20px;
}
}
But I've thought it should also work with .show if I reuse hideMe in reverse direction, something like
.show {
animation: hideMe 0.4s reverse;
}
instead of
.show {
animation: showMe 0.4s;
}
Did I misunderstand the concept?