ADBE Text Document boxTextSize attribute
hello,
i trying determine size , position of text box in text layer.
the attribute "boxtextsize" works expected, able retrive size of text box call :
mylayer.property(\"adbe text properties\").property(\"adbe text document\").value.boxtextsize;
but how can determine origin of text box relative anchor point (or vice-versa) ? strangely, when create text box in after effects (cc), anchor point automatically placed in center of box (visually), though reported numerical values anchor point layer (0, 0, 0). misinterpreting ?
thanks !
steph
you need math track down it's location. know there this, isn't fleshed out yet , brain isn't working @ moment, but...
var mylayer = app.project.item(1).layer(1); //your text layer
var mytextbox = mylayer.property("adbe text properties").property("adbe text document"); //the text box
var mytextboxsizex = mytextbox.value.boxtextsize[0]; //the text box x size
var mytextboxsizey = mytextbox.value.boxtextsize[1]; //the text box y size
var mylayerpx = mylayer.property("position").value[0]; //layer position x
var mylayerpy = mylayer.property("position").value[1]; //layer position y
var mylayerapx = mylayer.property("anchor point").value[0]; //layer anchor point x
var mylayerapy = mylayer.property("anchor point").value[1]; //layer anchor point y
var mytextboxcomplocationx = mylayerpx - mylayerapx; //should center x location of text box within comp space
var mytextboxcomplocationy = mylayerpy - mylayerapy; //should center y location of text box within comp space
/*
should able subtract anchor position find center of box offset box x or y divided 2 boundry line of box. may on thinking too.
*/
var mytextboxcomplocationrightboundrylinemaybe = (mytextboxsizey/2) - mytextboxcomplocationy;
alert(mytextboxcomplocationrightboundrylinemaybe);
maybe else can figure math out better on this. i'll keep thinking on it. know should doable though, not natively in extendscript know.
More discussions in After Effects Scripting
adobe
Comments
Post a Comment