-
Layer’s transformation matrix to obtain parent’s inverse transform
Hey, everyone.
Simply put, I’m trying to find a transformation matrix capable of emulating the regular layer transform properties, hence its inverse can be used to cancel out any parent layer’s transformation. So far, I’ve not been able to figure out the right operations and concatenation order for position. I think this matrix would be really useful in cases where a layer must follow certain transformations from another layer, without the hassle of assigning the leader layer by complex dynamic coding and just parenting instead.
Scale and rotation are easy enough to inverse by using something like the code above, but position is a totally different story since parent’s position, anchorPoint, scale and rotation come together into play.
These expressions work regardless of the layers hierarchy, which is nice. Hopefully I made myself clear.
Cheers.
//Reverse parent's scale
var x = length( toCompVec( [1, 0 ] ) );
var y = length( toCompVec( [0, 1 ] ) );
[ x * value[0], y * value[1] ]//Reverse parent's rotation
var c = toCompVec( [1, 0] );
-radiansToDegrees( Math.atan2( c[1], c[0] ) )//Reverse parent's position
????
Sorry, there were no replies found.