0

Goal is to keep the background red at the end of the animation.

Using chrome http://codepen.io/JulianNorton/pen/RNqLZM

.animation {
    -webkit-animation:test-animation 2s 2;
    // Animation stops after a few seconds, state doesn't stay red.
}


@-webkit-keyframes test-animation {
    0% {

        background-color:#fff
    }

    100% {
        background-color:red
    }
}

@keyframes test-animation {
    0% {
        background-color:#fff
    }

    100% {
        background-color:red
    }
}
Julian
  • 1,007
  • 1
  • 13
  • 23

2 Answers2

1
animation-fill-mode: forwards;  

is most likely what you were looking for. Source: CSS Animation property stays after animating

Community
  • 1
  • 1
Philipp Meissner
  • 5,273
  • 5
  • 34
  • 59
0

Just set the background color of your .animation element to red. Since the keyframe animation is triggered automatically, it will not appear red at first, but white like you want.

ingridly
  • 159
  • 10