why do you have to translate before rotating to rotate an element around himself in canvas?
I just started studying about HTML5 element and while trying to figure out how to rotate an element around himself I stumbled across a post saying that you have to translate the origin before rotating the element, and i was wonderin开发者_如何学运维g why is that? isn't translating just moves the origin from which you draw things to another point in the canvas?
You're not rotating the element, but the whole canvas. The canvas point of origin is in it's left-top corner. Translating to (-or actually, the oposite negative direction) your element first, would virtually translate the point of origin.
精彩评论