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