문제

Flash Tranformation Matrix via JsFL are mean to me :(

I have to write a JsFL script that creates a text on my Flash scene, and rotate it with a random angle. Imagine I want to create and rotate a "Hello World!" at 45 degrees, my code looks like that :



rotateAngle = 45;

//creates my new text at x:0, y:0 coordinates
fl.getDocumentDOM().addNewText({left:0, top:0, right:10, bottom:10});
fl.getDocumentDOM().setTextString('Hello World!');

var mat = fl.getDocumentDOM().selection[0].matrix; //get the current matrix

// set rotation
mat.a = Math.cos( rotateAngle );
mat.b = Math.sin( rotateAngle);
mat.c = - Math.sin(rotateAngle);
mat.d = Math.cos( rotateAngle );

fl.getDocumentDOM().selection[0].matrix = mat; //apply new matrix


the problem is : the rotation applied to my text is 58.3 instead of 45.

I have to admit that I'm kind of noob with matrix... so I used the "matrix transformation for rotation" here : http://www.senocular.com/flash/tutorials/transformmatrix/

Ideas ?

thank you.

도움이 되었습니까?

해결책

Have you tried with radians instead of degrees?

다른 팁

i'm pretty sure that you could also just use the following rather than go thru the matrix for the sake of simplicity.

var element = fl.getDocumentDOM().selection[0];
element.rotation = 45;

this avoids having to convert to radians as well since it takes degrees as an input value.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top