Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
@keyframes loading {
0%, 40%, 90% { background-color: rgb(35, 35, 35); }
70% { background-color: rgb(65, 65, 65); }
}
@keyframes filter-loading {
0%, 40%, 90% { filter: none; }
70% { filter: blur(1px); }
}
.target {
width: 20px;
height: 20px;
}
#target {
animation: loading 4s linear infinite;
}
#filter-target {
animation: filter-loading 4s linear infinite;
}
</style>
<div id="target" class="target"></div>
<div id="filter-target" class="target"></div>
<script>
function compositorAnimationDump() {
const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);
const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();
return [...animations, ...lines.filter(line => !animations.includes(line))];
}
function printCompositorAnimations(title) {
println(title);
for (const line of compositorAnimationDump())
println(` ${line}`);
}
asyncTest(async done => {
await Promise.all(document.getAnimations().map(animation => animation.ready));
internals.updateCompositorAnimations();
printCompositorAnimations("missing endpoints take the underlying style on the compositor:");
const backgroundAnimation = document.getElementById("target").getAnimations()[0];
backgroundAnimation.effect.setKeyframes([
{ backgroundColor: "rgb(35, 35, 35)", offset: 0 },
{ backgroundColor: "rgb(65, 65, 65)", offset: 1 },
]);
internals.updateCompositorAnimations();
printCompositorAnimations("complete keyframes use the compositor:");
backgroundAnimation.effect.setKeyframes([
{ backgroundColor: "rgb(35, 35, 35)", offset: 0 },
{ backgroundColor: "rgb(65, 65, 65)", offset: 0.7 },
]);
internals.updateCompositorAnimations();
printCompositorAnimations("removing the endpoint stays on the compositor:");
for (const animation of document.getAnimations())
animation.cancel();
done();
});
</script>