the_lotus the_lotus - 10 months ago 37
HTML Question

Is it safe to store the value of getContext

When using the canvas element. Is it safe to call getContext("2d") only once after the page is loaded? Or should I call this function every time I want to draw a frame?


Yes, it is save. Calling getContext("2d") repeatedly on the same canvas would always get you the same context object.