A good morning challenge.
Text layer 1 position:
margin = 50;
myTextWidth = thisLayer.sourceRectAtTime().width;
imageWidth = thisComp.layer("Image").sourceRectAtTime().width;
otherTextWidth = thisComp.layer("Text layer 2").sourceRectAtTime().width;
combinedWidth = myTextWidth+imageWidth+otherTextWidth+2*margin;
compCenterX = thisComp.width/2;
yPos = transform.position[1];
xPos = compCenterX+myTextWidth/2-combinedWidth/2;
[xPos, yPos]
Image position:
margin = 50;
text1PositionX = thisComp.layer("Text layer 1").transform.position[0];
text1Width = thisComp.layer("Text layer 1").sourceRectAtTime().width;
myWidth = thisLayer.sourceRectAtTime().width;
myXPosition = text1PositionX + text1Width/2 + margin + myWidth/2;
myYPosition = transform.position[1];
[myXPosition, myYPosition]
Text layer 2 position:
margin = 50;
text1PositionX = thisComp.layer("Text layer 1").transform.position[0];
text1Width = thisComp.layer("Text layer 1").sourceRectAtTime().width;
myWidth = thisLayer.sourceRectAtTime().width;
myXPosition = text1PositionX + text1Width/2 + margin + myWidth/2;
myYPosition = transform.position[1];
[myXPosition, myYPosition]
The text layers need to be center aligned and the anchor point of the image needs to be centered on the layer. Usually it is, but in some cases it isn’t, and if not should be fixed with Layer>Transform>Center anchor point in layer content.
Kalleheikki Kannisto
Senior Graphic Designer