Jump to content

thre

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by thre

  1. Been staring at this for hours, seen few tutorials and can't find the error. Can someone give me some direction. I believe this is suppose to let me draw but its doesn't. const canvas = document.querySelector("#canvas"); const ctx = canvas.getContext("2d"); canvas.height = window.innerHeight; canvas.width = window.innerWidth; let painting = false; function start(){ painting = true; } function end(){ painting = false; } function draw(e){ if (!painting) return; ctx.lineWidth = 10; ctx.lineCap = "round"; ctx.lineTo(e.clientX, e.clinetY) ctx.stroke(); } canvas.addEventListener("mousedown", start); canvas.addEventListener("mouseup", end); canvas.addEventListener("mousemove", draw);
×
×
  • Create New...