Code
Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy HTML Canvas globalAlpha Property</title> </head> <body> <h1>Wikitechy HTML Canvas globalAlpha Property</h1> <canvas id="wikitechyCanvas" width="300" height="180" style="border:2px solid green;"> </canvas> <script> var ga = document.getElementById("wikitechyCanvas"); var gax= ga.getContext("2d"); gax.fillStyle = "blue"; gax.fillRect(40, 40, 85, 60); gax.globalAlpha = 0.1; gax.fillStyle = "black"; gax.fillRect(80, 80, 85, 60); gax.fillStyle = "red"; gax.fillRect(100, 100, 85, 60); </script> </body> </html>
Result