2d.layer.several-complex.html (1122B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <link rel="match" href="2d.layer.several-complex-expected.html"> 5 <meta name=fuzzy content="maxDifference=0-3; totalPixels=0-6318"> 6 <title>Canvas test: 2d.layer.several-complex</title> 7 <h1>2d.layer.several-complex</h1> 8 <p class="desc">Test to ensure beginlayer works for filter, alpha and shadow, even with consecutive layers.</p> 9 <canvas id="canvas" width="500" height="500"> 10 <p class="fallback">FAIL (fallback content)</p> 11 </canvas> 12 <script> 13 const canvas = document.getElementById("canvas"); 14 const ctx = canvas.getContext('2d'); 15 16 ctx.fillStyle = 'rgba(0, 0, 255, 1)'; 17 ctx.fillRect(50, 50, 95, 70); 18 19 ctx.globalAlpha = 0.5; 20 ctx.shadowOffsetX = -10; 21 ctx.shadowOffsetY = 10; 22 ctx.shadowColor = 'orange'; 23 ctx.shadowBlur = 3 24 25 for (let i = 0; i < 5; i++) { 26 ctx.beginLayer(); 27 28 ctx.fillStyle = 'rgba(225, 0, 0, 1)'; 29 ctx.fillRect(60 + i, 40 + i, 75, 50); 30 ctx.fillStyle = 'rgba(0, 255, 0, 1)'; 31 ctx.fillRect(80 + i, 60 + i, 75, 50); 32 33 ctx.endLayer(); 34 } 35 </script>