41 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML5 Canvas</title> </head> <body> <p>Image yang akan di tampilkan :</p> <img id="laptop" width="200" height="200" src="laptopmee.png" alt="Laptop"> <p>Tampilan pada Canvas:</p> <canvas id="myCanvas" width="329" height="294" style="border:2px solid green;"></canvas> <script> window.onload = function() { var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); var img = document.getElementById("laptop"); ctx.drawImage(img, 5, 5); }; </script> </html> </body> Referensi : w3schools (modifikasi)
RkJQdWJsaXNoZXIy MTM3NDc5MQ==