Skip to content

Instantly share code, notes, and snippets.

@padmkris123
Created April 17, 2023 07:34
Show Gist options
  • Select an option

  • Save padmkris123/495dd2b5b44f751fe4437361d5ae2296 to your computer and use it in GitHub Desktop.

Select an option

Save padmkris123/495dd2b5b44f751fe4437361d5ae2296 to your computer and use it in GitHub Desktop.
UXP Canvas 2d example
function drawShape() {
const canvas = document.getElementById("canvas");
// get the canvas context
let context = canvas.getContext("2d");
//draw triangle
context.lineWidth = 2.0;
context.beginPath();
context.moveTo(20, 20);
context.lineTo(100, 20);
context.lineTo(100, 100);
context.lineTo(20, 20)
context.closePath();
context.strokeStyle = 'darkgoldenrod';
context.stroke();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment