How to add delay between CSS keyframe animation āš“

rajeshroyal

Rajesh Royal

Posted on March 16, 2022

How to add delay between CSS keyframe animation āš“

Problem Statement

I want the animation to run for 4 seconds.

~ plus ~

I want the animation to delay for 6 seconds in between iterations.

~ equals ~

10 total seconds

Here is how you achieve it.



.swing {
    animation: swing ease-in-out 5s infinite alternate;
    transform-origin: center -20px;
    animation-delay: 0s;
}
@keyframes swing {
    0% {
        transform: rotate(3deg);
    }
    30% {
        transform: rotate(-3deg);
    }
    40% {
        transform: rotate(0deg);
    }
}



Enter fullscreen mode Exit fullscreen mode

Demo:

add delay between css keyframes

You may change the animation and delay as per you need.

šŸ‘‹

šŸ’– šŸ’Ŗ šŸ™… šŸš©
rajeshroyal
Rajesh Royal

Posted on March 16, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related