Link in Zwischenablage kopieren
Kopiert
So since the width and height of a point text layer is
--always the size of the composition
--calculateTransformFromPoints can only set and not read a set of values
-- a point text layer's sourceRectatTime top and left values (as well as baselineLoc values) are relative, as far as I can tell, to its... anchor point? And
-- I can't rely on its anchor point since a) end users move the anchor point and b) we have other functions that periodically center the anchor point of every layer,
I was wondering if there were some other way to calculate the top and left values of a point text layer relative to the composition?
Do I have to draw a mask that is the full size of the layer and then derive the values from its vertices?
sourceRectatTime gives you the corners in layer space. Unfortunately scripting has no build-in function to convert layer space to comp space (expressions have it). Either you can hack using expressions (create an expression that computes the layer to comp space calculation and read its value) or you need to implement it yourself (i.e. recursively going over the layer and all its parents transform properties and compute how they change the position).
Link in Zwischenablage kopieren
Kopiert
bueller?
Link in Zwischenablage kopieren
Kopiert
sourceRectatTime gives you the corners in layer space. Unfortunately scripting has no build-in function to convert layer space to comp space (expressions have it). Either you can hack using expressions (create an expression that computes the layer to comp space calculation and read its value) or you need to implement it yourself (i.e. recursively going over the layer and all its parents transform properties and compute how they change the position).
Link in Zwischenablage kopieren
Kopiert
Thanks. Ugh. This is what I was afraid of. I have been trying sourcePointToComp() but I can find no documentation anywhere as to what parameters this method should take. comp.layer(1).sourcePointToComp() certainly doesn't work.
Link in Zwischenablage kopieren
Kopiert
oh, never mind. I see that you should pass boxTextPos
Link in Zwischenablage kopieren
Kopiert
You can use sourcePointToComp this way:
var time = comp.time;
var rect = comp.layer(1).sourceRectAtTime(time, false);
var pos = comp.layer(1).sourcePointToComp([rec.left, rect.top]);
Oddly enough, it doesnt take a time parameter, only a 2D point.
So you should set the comp.time to the one you want before using.
Xavier
Link in Zwischenablage kopieren
Kopiert
thanks. I ended up passing sourceText.value.boxTextPos but I need to handle keyframe values, so it looks like sourceRectAtTime() will be the way to go
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen