Skip to main content
June 15, 2011
Question

skew image with matrix, top angle good, bottom flat

  • June 15, 2011
  • 1 reply
  • 1077 views

Hello:

I am trying to skew an spark Image object using a matrix. The problem I am having is that it only effects the top angle. I think it may be related to the position of the image (x and y). The top angle is prefect but the bottom is flat!

Here is a bit of code:

//imgA = pixles down from top left coord, I used arctan with oposite over adjacent to get a radian angle

//size

openImage.width = imgW; //say 200

openImage.height = imgH; //say like 300

//angle & poisition

var ooa:Number = (imgA / imgW); //perhaps 20 / 200

var angle:Number = Math.atan(ooa);

var m:Matrix = new Matrix();

m.tx = imgX; //over 400

m.ty = imgY; //down 500

m.b = angle;

openImage.transform.matrix = m;

Can anyone explain why it only effects the top angle and the bottom is flat?

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 15, 2011

it's below your stage bottom or is masked?

June 15, 2011

No, it seems to occure when the b value is less than 0.1. If I just plug in 0.09 it has a flat bottom, but if it's beyond 0.1 it will have the same angle top and bottom.

kglad
Community Expert
Community Expert
June 15, 2011

i don't see a problem using:

var m:Matrix = new Matrix();

m.b=1;

var t:Timer=new Timer(300,0);
t.addEventListener(TimerEvent.TIMER,f);
t.start()

function f(e:Event):void{
    m.b-=.05
    openImage.transform.matrix=m;
}