Skip to main content
Participant
November 17, 2016
Question

A parallelogram with the class Matrix

  • November 17, 2016
  • 1 reply
  • 279 views

I have this image load :

This is a square and I would like to transform it like this :

Using the Matrix class. This is a parallelogram, not a rhombus, because the width is 100px and the height is 53px.

I have already done this :

var bmp:Bitmap = new Main.Grass();

addChild(bmp);

bmp.x = (stage.stageWidth - bmp.width) / 2;

bmp.y = (stage.stageHeight - bmp.height) / 2;

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
November 17, 2016

bmp.transform.matrix=new Matrix(1,0,-1,1,(stage.stageWidth-bmp.width)/2,(stage.stageHeight-bmp.height)/2);

Participant
November 17, 2016

This is not the exact figure what I wish and I don't see how to use the Matrix class properly

kglad
Community Expert
Community Expert
November 17, 2016

if your rectangles reg point is top-left, that should be pretty close.

i showed how to use the matrix class: for skewing, the 2nd parameter adjusts the y properties and the 3rd parameter adjusts the x properties.

from the look of your parallelogram, it appears you want to adjust the x property only.