Syntax error How to rotate an image with the canvas HTML5 element from the bottom center angle?

How to rotate an image with the canvas HTML5 element from the bottom center angle?



Translate the image dimensions to 32, 120 −

context.translate(32, 120);

Now rotate the canvas −

context.rotate(90 * Math.PI/180);

Now draw the image −

context.drawImage(img, -32, -120, 64, 120);
Updated on: 2020-06-25T07:06:08+05:30

312 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements