-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
background-color-animation-with-blur.html
55 lines (54 loc) · 1.38 KB
/
background-color-animation-with-blur.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color">
<link rel="match" href="background-color-animation-with-blur-ref.html">
<!-- Allow off by one errors on each color channel. -->
<meta name=fuzzy content="maxDifference=0-1;totalPixels=0-12100">
<style>
@keyframes colorize {
0% { background-color: blue; }
50% { background-color: green; }
100% { background-color: red; }
}
#target {
height: 100px;
width: 100px;
animation-name: colorize;
animation-duration: 100000s;
animation-timing-function: steps(2, end);
display: inline-block;
margin: 10px;
}
.blur {
filter: blur(5px);
}
.color-shift {
animation-delay: -50000s;
}
</style>
<body>
<div id="container">
<div id="target"></div>
</div>
</body>
<script src="/common/reftest-wait.js"></script>
<script type="text/javascript">
async function rAF() {
return new Promise((resolve) => {
requestAnimationFrame(resolve);
});
};
window.onload = async () => {
const anim = document.getAnimations()[0];
await anim.ready;
await rAF();
// Add blur filter while animation is running.
container.classList.add('blur');
await rAF();
// Shift animation to the midpoint.
target.classList.add('color-shift');
await rAF();
takeScreenshot();
};
</script>
</html>