HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <canvas id="point" width="100" height="200">Your browser does not support the canvas element. </canvas> <script> var canvas = document.getElementById('point'); var ctx = canvas.getContext('2d'); // Non-scaled rectangle ctx.fillStyle = 'gray'; ctx.fillRect(20, 10, 8, 20); // Scaled rectangle ctx.scale(3, 6); ctx.fillStyle = '#339933'; ctx.fillRect(20, 10, 8, 20); </script> </body> </html>
OUTPUT
×

Save as Private