animation-opacity-pause-and-set-time.html (1143B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-2500" /> 5 <title>CSS Animations Test: pauses a opacity animation and sets the current time</title> 6 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> 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-timing-function"> 10 <link rel="match" href="animation-opacity-pause-and-set-time-ref.html"> 11 <style> 12 #target { 13 width: 50px; 14 height: 50px; 15 background-color: green; 16 } 17 </style> 18 <body> 19 <div id="target"></div> 20 </body> 21 <script> 22 window.onload = () => { 23 requestAnimationFrame(() => { 24 let animation = document.getElementById("target").animate([ 25 {opacity: '0.8'}, 26 {opacity: '0.0'} 27 ], 1000); 28 requestAnimationFrame(() => { 29 animation.pause(); 30 animation.currentTime = 500; 31 document.documentElement.removeAttribute('class'); 32 }); 33 }); 34 }; 35 </script> 36 </html>