Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

A parallelogram with the class Matrix

New Here ,
Nov 16, 2016 Nov 16, 2016

I have this image load :

herbe.png

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

tile_herbe.png

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;

TOPICS
ActionScript
243
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2016 Nov 17, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2016 Nov 17, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2016 Nov 17, 2016
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines