canvas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

canvas

what is getContext("2d"); for?

1st Jun 2016, 3:44 AM
Jas Pun
Jas Pun - avatar
2 Answers
+ 3
It returns the drawing context of the canvas. The value "2d", makes an object representing a two-dimensional rendering context. Basically, it creates a 2D canvas object for you to draw with.
1st Jun 2016, 7:10 AM
James Flanders
0
thank you james flanders.
1st Jun 2016, 8:38 AM
Jas Pun
Jas Pun - avatar