Inserting text on drawn shapes in JavaScript

Hey there🤗
I want to know is it possible to print text on drawn shapes?
If anyone have an idea then please reply :hugs::innocent:

Nice profile pic :sunglasses::sunglasses: its really cool

1 Like

And also yes it is possible this are the codes

function draw(){
var drawing = document.getElementById(“drawing”);
var con = drawing.getContext(“2d”);
con.fillStyle = “red”;
con.strokeStyle = “green”;
con.lineWidth = “5”;
con.fillRect(10, 10, 180, 80);
con.strokeRect(10, 100, 180, 80);
} // end draw

And this is what it will look like

281646.image1

1 Like

Thank you so much for help.:innocent:
But I am unable to find these (.getElementById,Con.strokeRect, etc.) In codes playground of grasshopper app

Grasshopper doesn’t have those codes sorry

1 Like

OK but which application are you using?:blush:

I’m using Notepad++ in windows computer or mac

1 Like

Thank you :innocent::blush::hugs::+1::dizzy:for helping me :smiling_face_with_three_hearts:

No problem​:innocent::innocent::innocent::innocent::innocent::innocent::innocent::sunglasses::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent::innocent:

1 Like