Activity › Forums › Adobe After Effects Expressions › attaching an object to an updatable string of text
-
attaching an object to an updatable string of text
Cameron Pinegar replied 8 years, 9 months ago 7 Members · 38 Replies
-
Andre Isaac
November 2, 2010 at 7:27 amHello again-
Something I’ve noticed is that the expression seems to stop working once the object (the text that it is linked to) goes off the edge of the screen. When this happens the subject (text with expression applied) reverts to its original position value. Aside from a workaround (ie: expand the comp pixel size to accommodate object position and then render with cropped output settings) is there some way to avoid this problem?Thanks!
L = thisComp.layer("");
for (i = thisComp.width; i >= 0; i--){
temp = L.sampleImage([i,thisComp.height/2],[0.5,thisComp.height/2],true,time);
if (temp[3] > 0) break;
}
[i,value[1]] -
Dan Ebberts
November 2, 2010 at 3:31 pmYou can expand the bounds of the search. For example, to add 50 pixels to each edge of the comp, you could make this change:
for (i = thisComp.width+50; i >= -50; i–){
Dan
-
Andre Isaac
November 9, 2010 at 12:49 pmThanks again, Dan– You’ve been an immense help.
One more question: when I enter nothing or “space-button” into a targeted text-layer, the other texts whose positions are linked to it jump to the edge of the frame. Is there any way to make them hew to the position value of a text-layer with nothing or next-to-nothing in it?
right side
L = thisComp.layer("");
for (i = 0; i <= thisComp.width; i++){
temp = L.sampleImage([i,thisComp.height/2],[0.5,thisComp.height/2],true,time);
if (temp[3] > 0) break;
}
[i,value[1]] -
Dan Ebberts
November 9, 2010 at 5:17 pmI’m not sure what you mean exactly, but maybe like this:
L = thisComp.layer("parent");
if (L.text.sourceText != ""){
for (i = 0; i <= thisComp.width; i++){
temp = L.sampleImage([i,thisComp.height/2],[0.5,thisComp.height/2],true,time);
if (temp[3] > 0) break;
}
[i,value[1]]
}else{
[L.position[0],value[1]]
}
Dan
-
Andre Isaac
November 9, 2010 at 8:49 pmUnfortunately this seems to get the same result as before. I’m trying to build a template that can work with multiple layouts within a banner, each text-layer in AE corresponding to a cel in a database. The idea is for the same template to work with different combinations of text-layers (used or unused depending on the information). There are workarounds but I’m trying to automate this as much as possible. Thanks again!
-
Dan Ebberts
November 9, 2010 at 9:23 pmSorry, I missed the part about the space character. Try changing the second line to this:
if (L.text.sourceText != “” && L.text.sourceText != ” ” ){
If your text can multiple space characters or other non-printing characters, it’s not going to work. You’d need to have the expression examine the text for one or more characters that print. Not hard to do, just different.
Dan
-
Kim Nielsen
November 20, 2010 at 9:11 pmHi Dan,
Currently trying to figure out how to do this on the y axis instead of X.
Currently I have textfield(A) with a variable length in the y axis. I need to somehow make sure that the BOTTOM of textfield(a) stays fixed to textfield(b).
-
Dan Ebberts
November 20, 2010 at 10:40 pmThis should find the bottom of a text layer:
L = thisComp.layer("Your Text Layer");
for (i = thisComp.height; i >= 0; i--){
temp = L.sampleImage([thisComp.width/2,i],[thisComp.width/2,0.5],true,time);
if (temp[3] > 0) break;
}
[value[0],i]
Dan
-
Kim Nielsen
November 20, 2010 at 11:33 pmSorry I am not a native speaker, Ive probably been vague.
What I try is exactly the opposite. I want the bottom of the text that is being moved to attach itself to the top of the non-moving text.
So I want the bottom of L to position itself on the top of I
L = thisComp.layer(index+1);
for (i = thisComp.height; i >= 0; i--){
temp = L.sampleImage([thisComp.width/2,i],[thisComp.width/2,0.5],true,time);
if (temp[3] > 0) break;
}
[value[0],i]
Reply to this Discussion! Login or Sign Up