Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <html> <body> <canvas id="compCanvas" width="300" height="150" style="border:1px solid #d3d3d3;"></canvas> <script> var canvas = document.getElementById("compCanvas"); var ctx = canvas.getContext("2d"); // Draw the first rectangle ctx.fillStyle = "#FF8C00"; ctx.fillRect(50, 25, 100, 100); // Use a composite operation to draw the second shape ctx.globalCompositeOperation = "destination-over"; // Draw the second rectangle under the first one ctx.fillStyle = "#0070C0"; ctx.fillRect(20, 60, 200, 50); </script> </body> </html>