Friday, February 10, 2023

Transformation JavaScript 2nd

 ctx.scale(x,y);

ctx.translate(x,y);

ctx.rotate(angle); in radians

ctx.transform(a,b,c,d,e,f);

*1* - Given ctx.translate(21,12);

returned in the console.log:

    ctx.transform(1,0,0,1,21,12);

--------------------------------------------------------------------------------------------------------------------------

*2* - Given ctx.scale(10,20);

returned in the console.log:

    ctx.transform(10,0,0,20,0,0,);

--------------------------------------------------------------------------------------------------------------------------

*3* - Given ctx.rotate(45*Math.PI/180);

returned in the console.log:

    ctx.transform(0.707...6, 0.707...5,-0.707...5, 0.707...6,0,0);

in other words : a = d; b = -c.

--------------------------------------------------------------------------------------------------------------------------

Still using the console.log

There you gonna find a,b,c,d,e,f and

Also have m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44.





Rute Bezerra de Menezes Gondim

No comments:

Post a Comment