Created
April 17, 2023 07:34
-
-
Save padmkris123/495dd2b5b44f751fe4437361d5ae2296 to your computer and use it in GitHub Desktop.
UXP Canvas 2d example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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