Simple question, I'm drawing an image on the canvas using ctx.drawImage(img, 500, 500);
I want to rotate this image around its central axis an undetermined degrees measure (somewhere from 0-360). I know that there is a jQuery library called jQuery rotate. However, I looked at the API of this, and it looks like it only can rotate HTML elements. I know I could rotate the entire canvas, but that is not really what I want because there are other things being drawn that I don't need rotated. Is there any way I can rotate just the one image using jQuery or javascript?
Asked
Active
Viewed 269 times
0

Ashwin Gupta
- 2,159
- 9
- 30
- 60
-
jQuery is only for DOM Elements, so no you can't. But with Javascript you can--view the link Downgoat posted. – May 03 '16 at 23:39
-
@Jerry yeah I did, we were talking about it in PPCG chat, I think that it will work. Although, he suggested (since he is more up-to-date on my project and has seen it quite a bit) that I should change my objects to DOM elements and just work with those since its easier. IDK, will see. – Ashwin Gupta May 04 '16 at 00:49