the_lotus the_lotus - 1 year ago 57
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?

Answer Source

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