mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03:00
6f87955243
This option stops all kinds of CSS animations while doing screenshot: - CSS animations - CSS transitions - Web Animations Animations get different treatment depending on animation duration: - finite animations are fast-forwarded to its end, issuing the `transitionend` event. - Infinite animations are resetted to its beginning, and then resumed after the screenshot. References #9938, fixes #11912
32 lines
842 B
HTML
32 lines
842 B
HTML
<html>
|
|
<head></head>
|
|
<body></body>
|
|
<script>
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
const shadow = document.body.attachShadow({mode: 'open'});
|
|
shadow.append(document.createElement('div'));
|
|
const style = document.createElement('style');
|
|
style.textContent = `
|
|
div {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 200px;
|
|
height: 100px;
|
|
background-color: red;
|
|
animation-name: z-spin;
|
|
animation-duration: 5s;
|
|
animation-iteration-count: infinite;
|
|
animation-timing-function: linear;
|
|
}
|
|
|
|
@keyframes z-spin {
|
|
0% { transform: rotateZ(0deg); }
|
|
100% { transform: rotateZ(360deg); }
|
|
}
|
|
`;
|
|
shadow.append(style);
|
|
}, false);
|
|
</script>
|
|
</html>
|