0

I'm trying to make a blinking animation for a piece of text that goes from black to white instantly with no fading. Right now it fades to to white then instantly snaps to white

my code:

.flash {

    animation-name:blinkAni;
    animation-duration:1s;
    animation-iteration-count:infinite;
}

@keyframes blinkAni {
        0% {color:black}
        100% {color:white}
}
David
  • 39
  • 3

1 Answers1

0

Use the animation-timing-function: steps(1) property and set your white state at 50%:

.flash {
    background: #CCC;
    animation-name:blinkAni;
    animation-duration:1s;
    animation-iteration-count:infinite;
    animation-timing-function: steps(1);
}

@keyframes blinkAni {
   0% {color:black}
   50% {color:white}
}
<p class="flash">Hello</p>
Kaiido
  • 123,334
  • 13
  • 219
  • 285