Stopping a CSS3 Animation on last frame

前端 未结 8 1232
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 04:48

I have a 4 part CSS3 animation playing on click - but the last part of the animation is meant to take it off the screen.

However, it always goes back to its origin

8条回答
  •  死守一世寂寞
    2020-11-22 04:58

    -webkit-animation-fill-mode: forwards; /* Safari 4.0 - 8.0 */
    animation-fill-mode: forwards;
    

    Browser Support

    • Chrome 43.0 (4.0 -webkit-)
    • IE 10.0
    • Mozilla 16.0 ( 5.0 -moz-)
    • Shafari 4.0 -webkit-
    • Opera 15.0 -webkit- (12.112.0 -o-)

    Usage:-

    .fadeIn {
      animation-name: fadeIn;
        -webkit-animation-name: fadeIn;
    
        animation-duration: 1.5s;
        -webkit-animation-duration: 1.5s;
    
        animation-timing-function: ease;
        -webkit-animation-timing-function: ease;
    
         animation-fill-mode: forwards;
        -webkit-animation-fill-mode: forwards;
    }
    
    
    @keyframes fadeIn {
      from {
        opacity: 0;
      }
    
      to {
        opacity: 1;
      }
    }
    
    @-webkit-keyframes fadeIn {
      from {
        opacity: 0;
      }
    
      to {
        opacity: 1;
      }
    }
    

提交回复
热议问题