Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-color/canvas-change-opacity.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="greensquare-ref.html">
<script src="/common/rendering-utils.js"></script>
<script src="/common/reftest-wait.js"></script>
<p>Test passes if you see a green square, and no red.</p>
<div style="position: absolute; width: 12em; height: 12em; background: red"></div>
<canvas id="canvas" style="position: relative; width: 12em; height: 12em; opacity: 0.2"></canvas>
<script>
const ctx = canvas.getContext("2d");
ctx.fillStyle = "green";
ctx.fillRect(0, 0, canvas.width, canvas.height);
waitForAtLeastOneFrame().then(() => {
canvas.style.opacity = 1;
takeScreenshot();
});
</script>
</html>