J
J
John Gault2015-12-11 12:46:56
css
John Gault, 2015-12-11 12:46:56

Animation delay / sequencing across multiple @keyframes?

There are two animations that I want to run in sequence, not at the same time, how do I do that?

.cd-add{
  animation: translate 1s linear forwards,
             opacity 1s linear forwards;
}

@keyframes translate{
  0%{
    transform: translate(0, 0);
  }
  100%{
    transform: translate(0, 100px);
  }
}
@keyframes opacity{
  0%{
    opacity: 0;
  }
  100%{
    opacity: 1;
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kravchenko, 2015-12-11
@mydearfriend

.cd-add{
  animation: translate-opacity 1s linear forwards;
}

@keyframes translate-opacity{
  0%{
    transform: translate(0, 0);
    opacity: 0;
  }
  50%{
    transform: translate(0, 100px);
    opacity: 0;
  }
  100%{
    opacity: 1;
    transform: translate(0, 100px);
  }
}

V
vvvadimos, 2015-12-11
@vvvadimos

there is an animation-delay property, maybe you were looking for it
htmlbook.ru/css/animation-delay

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question