<html lang="en"> <head> <title> Newton Fractal </title> </head> <body> <canvas id="MyCanvas" height="400" width="400" style="border: 2px solid black;"> </canvas> <div id="output"> </div> <script> "use strict" // get the canvas and associated parts const canvas = document.getElementById("MyCanvas") const ctx = canvas.getContext("2d") const height = canvas.height const width = canvas.width function X(inset) { ctx.beginPath() ctx.moveTo(0 + inset, 0 + inset) ctx.lineTo(width - inset, height - inset) ctx.strokeStyle = "Red" ctx.stroke() ctx.beginPath() ctx.strokeStyle = "Blue" ctx.moveTo(0 + inset, height - inset); ctx.lineTo(width - inset, 0 + inset) ctx.stroke() } function ChangePicture() { X(20); } ChangePicture(); </script> </body> </html>