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.