Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • CSS3 Animation Iteration Count Property

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 119
    Comment on it

    In this blog I am going to tell you about  Animation Iteration Count Property of CSS3. How many times an animation cycle should play is defined with the help of Animation Iteration Count Property of CSS3.

    Syntax for the Animation Iteration Count Property of CSS3. is defined below:-

    animation-iteration-count: number|inherit|intial|infinite;
    
    • number - It specifies how many times an animation should be played. The default value of this property is 1.
    • infinite -  It specifies that animation could be played infinite times.
    • initial -  It basically sets this property to its default value.
    • inherit - Inherit is used to inherit the property from the parent element.

    Step1- HTML goes like this:-

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    
    <div class="inherit"></div>
    <p><b>Note:</b> When the Animation gets completed,
      the element goes back to its original position </p>
    
    </body>
    </html>
    

    Step2- CSS

    .inherit{
    width:200px;
    height:200px;
    background:#0693CA;
    animation-name:demo;
    animation-duration:4s;
    animation-delay:2s;
    animation-iteration-count:6;
    -webkit-animation-name:demo; /* Prefix for Safari and Chrome */
    -webkit-animation-duration:4s;
    -webkit-animation-delay:2s;
    -webkit-animation-iteration-count:6;
    border-radius:99px;
    }
    
    @keyframes demo
    {
        0% {transform:translate(0px);
            animation-timing-function:ease-in-out;}
        
     100% {transform:translate(200px);
           animation-timing-function:ease-in-out;}
    }
    
    @-webkit-keyframes demo /* Prefix for Safari and Chrome */
    {
     0% {-webkit-transform:translate(0px);
        -webkit-animation-timing-function:ease-in-out;}
      
     100% {-webkit-transform:translate(200px);
           -webkit-animation-timing-function:ease-in-out;}
    }

    In the above steps  I make a div named inherit then I apply animation-name, animation-duration and animation-delay property to that div. Animation name property of css tells about a name for the keyframes animation. Animation-delay property defines a delay for the start of an animation and it is defined in seconds or milliseconds. To complete one cycle how many seconds or milliseconds an animation takes is specified by Animation-delay property.

    Working Demo :-https://jsfiddle.net/founhn8z/1/

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: