tags:

views:

18

answers:

1

I have a UI component that I wish to relocate and scale, but in a rather complex way. I've figured out the necessary transformations using the transform matrix, to which I applied several translate and scale operations.

I can set the new transform matrix for this UI component to be the above calculated matrix, and the results are accurate; but I need to animate the transition. I can't use the Scale/Move effects alone because they aren't as powerful when it comes to calculating the necessary transformation as the matrices are.

So how can I animate the transition of an object given a source and a target transform matrix?

Figured it out

Using a tweener and its onUpdate event to reassign the matrix with each intermediate value:

var animMatrix : Matrix = gi.transform.matrix;

TweenMax.to(animMatrix, 1, { 
    a : m.a,
    d : m.d,
    tx : m.tx,
    ty : m.ty,
    onUpdate : function () : void { gi.transform.matrix = animMatrix; }
});             
A: 

have you tried Quaternions?

Dan
how is this relevant? (I'm not rotating anything.. and the question was about animation)
Assaf Lavie