animation-iteration-count-006-manual.html (1510B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Animations Test: animation-iteration-count - 0 (zero)</title> 4 <link rel="author" title="Nokia Inc." href="http://www.nokia.com"> 5 <link rel="author" title="Intel" href="http://www.intel.com"> 6 <link rel="reviewer" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2015-05-06 --> 7 <link rel="help" href="https://drafts.csswg.org/css-animations-1/#animation-name"> 8 <link rel="help" href="https://drafts.csswg.org/css-animations-1/#animation-duration"> 9 <link rel="help" href="https://drafts.csswg.org/css-animations-1/#animation-iteration-count"> 10 <meta name="flags" content="animated"> 11 <meta name="assert" content="When animation-iteration-count is set to 0 (zero), no animation is seen."> 12 <style> 13 div { 14 animation-name: sample; 15 animation-duration: 10s; 16 17 background-color: blue; 18 height: 100px; 19 width: 100px; 20 position: relative; 21 } 22 23 @keyframes sample { 24 from { 25 left: 150px; 26 } 27 to { 28 left: 0px; 29 } 30 } 31 </style> 32 <body> 33 <p> 34 Test passes if there is a filled blue square with 'Filler Text', 35 which starts staying left for about 2 seconds upon page load, 36 then moves from right to left once. 37 </p> 38 <div>Filler Text</div> 39 <script> 40 var div = document.getElementsByTagName("div"); 41 div[0].style.animationIterationCount = 0; 42 setTimeout(setAnimationDuration, 2000); 43 44 function setAnimationDuration() { 45 div[0].style.animationIterationCount = 1; 46 } 47 </script> 48 </body>