Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html class="reftest-wait">
<title>image-animation: paused freezes at the current frame when transitioning from running</title>
<meta charset="utf-8" />
<link rel="match" href="image-animation-paused-exact-frame-ref.html" />
<script src="/common/reftest-wait.js"></script>
<script src="resources/image-animation-utils.js"></script>
<script>
function loaded() {
document.getElementById('img1').style.imageAnimation = 'running';
// The GIF has 3 frames:
// Frame 1: red, 20ms (passes quickly)
// Frame 2: green, 200ms (we pause during this frame)
// Frame 3: blue
//
// Wait 100ms so we are well past frame 1 (20ms) but still within
// frame 2 (200ms), then pause. The paused image should show frame 2
// (green), proving that pausing freezes at the current frame.
waitForFrameTime(100).then(() => {
document.getElementById('img1').style.imageAnimation = 'paused';
requestAnimationFrame(()=>{
takeScreenshot();
})
});
}
</script>
<style>
img {
image-animation: paused;
}
</style>
<img id="img1" src="../../images/anim-rgb.gif" onload="loaded()" />
</html>