Skip to main content
Participant
February 18, 2024
Question

editing text style inside an expression

  • February 18, 2024
  • 1 reply
  • 274 views

I made a counter with an expression in a text layer. I wanted to append a text at the end of the expression but, as it is a formula I need to write it with subscripts and/or superscripts.

I know I can't edit the style inside an expression so my thought and question is how to link another text layer with my formula with the sub and superscripts to follow the increasing movement of the counter.

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
February 18, 2024

Assuming that the number part is in a layer named "number" and that the two layers are already aligned in the y direction, a position expression like this for the formula layer should work (just set gap to the space you want between the two layers):

gap = 20;
L = thisComp.layer("number");
r = L.sourceRectAtTime(time,false);
x = L.toComp([r.left+r.width, r.top])[0];
r2 = sourceRectAtTime(time,false);
myX = toComp([r2.left, r2.top])[0];
value + [x - myX + gap, 0]

 

 

ERBIBIAuthor
Participant
February 18, 2024

Thanks. Gonna try