October 2016
Beginner to intermediate
709 pages
16h 52m
English
The HTML5 canvas methods can do more than just coloring the text or adding drop shadows. You can also use it to move or manipulate the objects in the canvas area. In this recipe, we will rotate the objects in the canvas.
This recipe builds on top of the previous recipes. If you skipped them, that's okay, you can go back to the previous recipe to refer to the complete code.
Once you have your previous recipe's canvas set up, the basic steps for rotation are easy. Add a rotate method to the beginning of the function:
context.rotate(Math.PI/4,0,0);
You will probably notice that the text rotated right off of the canvas. What happened? The rotate method rotates the entire canvas and is not aware ...
Read now
Unlock full access