HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <canvas id="point" width="120" height="250">Your browser does not support the canvas element. </canvas> <script> const canvas = document.getElementById("point"); const ctx = canvas.getContext("2d"); // Save the default state ctx.save(); ctx.fillStyle = '#339933'; ctx.fillRect(10, 10, 100, 100); // Restore the default state ctx.restore(); ctx.fillRect(10, 140, 100, 100); </script> </body> </html>
OUTPUT
×

Save as Private