-
Source text generated via expression not displaying correctly
Hi Guys. I’m rotating a text layer around a circle. It is parented to a null in the center and the null is rotating. I’ve added a bit to my expression to know the global position of the text layer. I’m trying to write the below expression in the Source Text so the layout of the text remains the same regardless of what side of the circle it falls on. I’d like to keep the “Name” closest to the circle regardless of what side of the circle it is on as in IMAGE 1 below. I’ve been able to get the text to auto-orient despite the 360 degrees of rotation the text is always facing the correct direction both horizontally and vertically but I can’t figure out how to keep the “Name” field closest to the circle (IMAGE 2). My issue is with the source text expression. I wrote a conditional if/else statement that basically says: If the global position of the text is greater than 960 then do “Name – Date”, else if the text is less than 960 then do “Date – Name”. Here is what I have so far:
txt1 = thisComp.layer("Name").text.sourceText + " - " + thisComp.layer("Date").text.sourceText;
txt2 = thisComp.layer("Date").text.sourceText + " - " + thisComp.layer("Name").text.sourceText;
s = thisLayer;
globalPos = s.toComp(s.anchorPoint)[0];
if (globalPos > 960) txt1 else txt2It actually seems to work ok in that I can see the layer bounding box expands to the length of those concatenated source text values, but it simply doesn’t display correctly. It’s only showing the default value of the text as if there wasn’t an expression on that source text.
I should also mention that I have expressions on the scale (which I use to maintain the proper orientation of the text) and on the anchor point (which I use to maintain the proper distance from the circle). When I turn the anchor point expression off that text displays as it should according to the expression above. However, when the anchor point expression is turned on the text does not display correctly, but rather returns the default value as described above.
Here are some images to help show what I’m talking about:
Any help would be greatly appreciated. Thank you!


