CSS3 animation - smooth infinite cycle

前端 未结 2 1843
后悔当初
后悔当初 2020-12-29 13:17

I\'ve made a small background animation where a div changes color over time. It works smoothly, but when it gets to 100% it jumps straight to 0% without any transition. I\'v

2条回答
  •  没有蜡笔的小新
    2020-12-29 13:39

    There is the animation-direction property, which could be set to alternate to have it run back and forth instead of jumping back to 0% again.

    -webkit-animation: pulsate 20s infinite alternate;
    animation: pulsate 20s infinite alternate;
    -moz-animation: pulsate 20s infinite alternate;
    

    EDIT: zessx just posted a fiddle before removing it again. I just updated that with the alternate option. Works fine. fiddle

提交回复
热议问题