HTML Style Animation IterationCount Property | Animation IterationCount Tutorial By WDH

HTML Style Animation IterationCount Property


 

Return the animationIterationCount property:

var v = object.style.animationIterationCount 

Set the animationIterationCount property:

object.style.animationIterationCount='number|infinite|initial|inherit'

 

number

how many times to play the animation. Default value is 1

infinite

play the animation for ever



 
Default Value: 1
Return Value: A string representing the animation-iteration-count property
CSS Version CSS3

Example

The following code shows how to change the animationIterationCount property of a <div> element.


<!DOCTYPE html>
<html>
<head>
<style> 
div {<!--from  w  w  w . j  a v a 2 s  .  c o  m-->
    width: 100px;
    height: 100px;
    background: red;
    position: relative;
    -webkit-animation: mymove 2s 1;  /* Chrome, Safari, Opera */
    animation: mymove 2s 2;
}

/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
    from {left: 0px;}
    to {left: 200px;}
}

@keyframes mymove {