Answer the question
In order to leave comments, you need to log in
Two transformations at once?
I draw on canvas, I need to apply two transformations of different parameters at once.
Well, let's say two turns at once. Only one around one point (say, the center of the figure), and the second around the second (for example, points 0; 0).
What to do?
Answer the question
In order to leave comments, you need to log in
Apply transformations sequentially. For example, a rotation transformation around a point is the product of move, turn, and move back:
var tx = -75; var ty = -75;
var a = -Math.PI/8; var c = Math.cos(a); var s = Math.sin(a);
context.transform(1, 0, 0, 1, -tx, -ty); // translate
context.transform(c, -s, s, c, 0, 0); // rotate
context.transform(1, 0, 0, 1, tx, ty); // translate
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question